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
-
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 -
WordPress image urls - need a WP maven
We were having a conversation re urls that are indexed for images that are stored in various media plugins in WP. My question for anyone who is an uberWP person is: What is your opinion re best media storage plugins and how these URLs affect pages on a site for ranking, etc. I realize this is broad, but it is driven out of my concern that I cannot touch everything. When I see a url like this: http://www.drumbeatmarketing.net/wp-content/themes/drumbeat2/img/DB-LOGO-White.png I know there is no way with all the sites and clients we handle that I can get it perfect but this just bugs me for some reason. Should I just chill since it (seemingly) affects so little....?
On-Page Optimization | | RobertFisher1 -
Which URL Structure is best for New Website?
Hello All, I have one client and he want to develop his website but the he want the URL structure for his website page like below: http://www.example.com/category/xxproduct.html But I have suggest him below URL Structure http://www.example.com/category/xx-product.html So Can you people please suggest me that from above which URL structure is better from SEO side as well as from Visual side..? Is using - is better to separate the words in URL?
On-Page Optimization | | jemindesai0 -
Dates in URL's
I have an issue of duplicate content errors and duplicate page titles which is penalising my site. This has arisen because a number of URLs are suffixed by date(s) and have been spidered . In principle I do not want any url with a suffixed date to be spidered. Eg:- www.carbisbayholidays.co.uk/carbis-bay/houses-in-carbis-bay/seaspray.htm/06_07_13/13_07_13 http://www.carbisbayholidays.co.uk/carbis-bay/houses-in-carbis-bay/seaspray.htm/20_07_13/27_07_13 Only this URL should be spidered:- http://www.carbisbayholidays.co.uk/carbis-bay/houses-in-carbis-bay/seaspray.htm I have over 10,000 of these duplicates and firstly wish to remove them on block from Google ( not one by one ) and secondly wish to amend my robots.txt file so the URL's are not spidered. I do not know the format for either. Can anyone help please.
On-Page Optimization | | carbisbayhols0 -
Can bad text URLs hurt pages?
If you have some pages that contain plain text URLs (not anchored links) that used to be good URLs, but are now bad, either because the website shut down or because it has been acquired by someone else and is now parked (or worse) - are those URLs enough to cause quality problems? For example: This information was brought to you by Waymaker http://www.waymaker.net These aren't the only ones. And yes, I know I should fix them, but there are probably 10,000 pages like it. I will fix them, but its not something I can do in a few minutes. (this one is easy to fix programmatically, but others are a lot more complex) So my question is: do you have actual experience that these are bad enough to cause ranking problems (making them low quality)
On-Page Optimization | | loopyal0 -
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 -
Trailing slash on URLs
Hi everyone My question is regarding trailing URLs in Wordpress A designer setup a site and made the URL structure something like: www.website.com/description/ but I want to change it to www.website.com/description as this is more SEF A trailing / was added to the permalink structure in Wordpress, if I change this will google see these as new URLs and will all the current URLs become 404? Or should I just leave it? Thanks in advance
On-Page Optimization | | webseoservices0 -
Does google treat all urls equal?
Sorry for the lame title, i couldn't think of a better one. I want to know if google treats this: http://www.domain.com/products/some-product-name the same as it would treat: http://www.domain.com/?products=some-product-name if not, could you tell me the differences?
On-Page Optimization | | adriandg0