Correct .htaccess settings for canonical url?
-
I want to forward all urls to http:www.mysite.com but am a little confuse because I am getting duplicate content error:
Pages with Duplicate Page Content
as of Jan 15http://titanappliancerepair.com/ 1 duplicatehttp://titanappliancerepair.com 1 duplicatehttp://titanappliancerepair.com/index.html 1 duplicate*****************************************************************What should I put ion htaccess file so I can forwardhttp://titanappliancerepair.com/index.htmlhttp://titanappliancerepair.comhttp://titanappliancerepair.com/to http://www.titanappliancerepair.comor what is the correct way to do it?I'm confused because when I enter http://titanappliancerepair.com/ in browser it showshttp://titanappliancerepair.com so how can it be considered duplicate content?.Can someone help?I have godaddy and they have gave me this code to put RewriteEngine on
rewritecond %{http_host} ^coolexample.com [nc]
rewriterule ^(.)$ http://www.coolexample.com/$1 [r=301,nc]What is correct? -
your directories have duplication. For example: http://www.titanappliancerepair.com/about-us.html and http://www.titanappliancerepair.com/about-us
You may also need RewriteRule ^(.*).html$ /$1 [R=301**,**L]
-
Ok I have added this to htaccess file and everything seems to be redirecting in browser ok but is it good enough for google?
Can someone check and tell me if it is correct , if not can you help with code? Thanks in advance!
RewriteEngine on
rewritecond %{http_host} ^titanappliancerepair.com [nc]
rewriterule ^(.*)$ http://www.titanappliancerepair.com/$1 [r=301,nc]RewriteEngine on
rewritecond %{http_host} ^titanappliancerepair.com/ [nc]
rewriterule ^(.*)$ http://www.titanappliancerepair.com/$1 [r=301,nc]RewriteEngine on
rewritecond %{http_host} ^titanappliancerepair.com/index.html [nc]
rewriterule ^(.*)$ http://www.titanappliancerepair.com/$1 [r=301,nc]RewriteEngine on
RewriteBase /redirect html pages to the root domain
rewriterule ^index.html$ / [r=301,nc]
-
It looks like you are redirecting any URL back to itself.
You want something like this which will remove index.html and enforce a trailing slash-
RewriteRule ^(.*)/index.html$ /$1/ [R=301,L]
-
This is what I have so far in htaccess file
RewriteEngine on
rewritecond %{http_host} ^titanappliancerepair.com [nc]
rewriterule ^(.*)$ http://www.titanappliancerepair.com/$1 [r=301,nc]RewriteEngine on
rewritecond %{http_host} ^coolexample.com/ [nc]
rewriterule ^(.*)$ http://www.titanappliancerepair.com/$1 [r=301,nc]RewriteEngine on
rewritecond %{http_host} ^coolexample.com/index.html [nc]
rewriterule ^(.*)$ http://www.titanappliancerepair.com/$1 [r=301,nc]RewriteEngine on
rewritecond %{http_host} ^www.titanappliancerepair.com/index.html [nc]
rewriterule ^(.*)$ http://www.titanappliancerepair.com/$1 [r=301,nc]
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Having country in page url, good idea or bad idea?
Lets say i sell louisville hockey sticks if i have a page url as louisville-hockey-sticks-canada is this better than louisville-hockey-sticks I have a .CA domain
On-Page Optimization | | garmatinc0 -
Worth Dropping www. from Domain Name to Shorten URL
The Moz page grader identified several pages where the only problem is the length of the URL, above 75 characters. The site uses uses the www. prefix, and has for years, since 2001. Is it worth dropping the www. and doing a redirect to https://domainname.com to gain the 4 characters
On-Page Optimization | | FatRodent20130 -
Blog Site Set-Up/Frequency
Hello! I am a new blogger that is just getting started. All I have done so far is purchase a domain name and signed up with Blue Host. From what I am reading, WordPress seems to be the most recommended plug-in to get going. There is a lot of material out there on SEO and I wanted the community's thoughts on where to start. My blog is intended to provide readers with information on a particular topic. It is a vast area with much to write about - I intend on populating the content myself/with the help of experts in the field. It is not news so it is not time sensitive. Here are my questions: 1. As this is a brand new site, should I be blogging every day or is couple of times a week sufficient? I am able to produce content fairly quickly in the beginning as there is a lot to write about. Should I write a whole lot of content first and then release it on a schedule (twice a week, daily, etc.)? As it is a new site, I don't want it to launch with just one article.. 2. I am taking a WordPress class next week, but as someone that is not too familiar with copy/backlinks, other mechanisms to boost SEO. does WordPress make it easy enough to optimize your site for search results or does it require more expertise? As far as I see, my first tasks are to 1. ) set up the site effectively so people can find it and 2.) create valuable/engaging content. Appreciate any advice on setting up the site, blogging frequency, other tips to get going. I don't want to launch a site and get dinged by Google for reasons I am unware of..At some point, when I have a robust set of content, I am thinking of FB advertising to increase traffic to the site. Seems a bit premature to do that at this point.. Thanks all in advance for your feedback!
On-Page Optimization | | mmprakash0 -
Display URL changed for Organic Regional Searches?
Hey. We currently have a US version of the site (/us) which is displaying in US Google Search. However the /us domain is also showing for our co.uk Google searches. Is there a way I can ensure the /us is only displayed for US searches? Any thoughts would be greatly appreciated 🙂
On-Page Optimization | | LoveCrafts0 -
Sorry, but that URL is inaccessible
Our site is all on the https protocol so every time I use the on-page grader it tells me the link is unavailable. What can we do? When I use the http protocol (which is 301 redirected to the https) it still gives me the same message.
On-Page Optimization | | whiskeyfl1 -
Canonical tag help
Hi, We have a product which is marketed by affiliates . Affiliates send referrals to our sale page by adding their affiliate IDs to our product page like http://www.mysite.com/products.php?ref= 12345. We want to avoid the content duplication impression to Google by using canonical tags but we are not clear about its use. Should we use it on http://www.mysite.com/products.php ( actual page) or we should create temporary pages for each referral id i.e http://www.mysite.com/products.php?ref= 12345 and then add canonical tags to all those pages linking to proper page i.e http://www.mysite.com/products.php ? Thanks, shaz
On-Page Optimization | | shaz_lhr0 -
How to deal with tracking numbers in URLs
I am working on a site at the minute that has links like this: Jobs in London URL looks like: domain.com/jobs-in-london/ However, my developers insist that they need to use tracking codes, so everytime someone clicks on the above link, they are redirected (301) to a new URL that looks like: domain.com/search/1234567(unique search id) This is killing me when I am trying to get internal pages, like /jobs-in-london/ ranked. What to do?
On-Page Optimization | | MirandaP0 -
URL best practices, use folders or not ?
Hi I have a question about URLs. Client have all URL written after domain and have only one / slash in all URLs. Is this best practice or i need to use categories,folders? Thanks
On-Page Optimization | | 77Agency0