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
-
Changing url (permalink) structure of website??
Currently I'm working on SEO of one website www.mocomi.com. I want to change url (permalink) structure of entire website which has more than 5000 pages. Currently website have structure of http://mocomi.com/tenali-raman-the-kings-condition/ Which I want to change it to http://mocomi.com/fun/stories/tenali-raman/tenali-raman-the-kings-condition/ Likewise I want to change entire website permalink url structure to make site architecture more SEO friendly. Which means I'am going to add only categories & subcategories before actual link. Kindly guide with following questions which I need to move forward with this step. How much is it worth to change URL structure? Checklist or factors I need to consider while making this decision? Is it a good practice to change URL's of entire website at once or Should I change it in Parts? How much time it takes google to rank those urls again? Which are the best practices to do so?
On-Page Optimization | | Mocomi1 -
Change of URL + SEO Impact
We recently changed the URLs from our site http://www.website.com (old)
On-Page Optimization | | ederdesign
https://website.com/us/en/ (new) Our ranking is plummeting every since and I wonder if the new URL had something to do with it. Do you know if that change, could have impacted the ranking?0 -
How to 301 redirect, without access to .htaccess and to a new domain
There are few ways to do this and I would like to ask other Mozzers if they have found the best way. We have a site .co.uk and are moving it back to .com. However we do not have any access to the site folders for .co.uk. (We have to move it anyway as our provider is withdrawing their service). We have built our URL 301 redirect file and it is ready to go, but how to impliment it? We can repoint .co.uk to another site, and then redirect all traffic for each URL but this is quite messy, or just forget trying to 301 each page and just rediect the whole site.
On-Page Optimization | | BruceA
the .com has more authority already, but we ready do not want to frustrate visitors who are using a link to reach a product, only to find they hit our homepage and not the product. Your thoughts would be very welcome or other ideas Bruce0 -
Using keywords in my URL: Doing a redirect to /keyword
My website in "On Page Grade" received an A.Anyway, I only have 1 thing to optimize:_"Use Keywords in your URL__Using your targeted keywords in the URL string adds relevancy to your page for search engine rankings, assists potential visitors identify the topic of your page from the URL, and provides SEO value when used as the anchor text of referring links."_My website is ranking in top10 for a super high competitive keyword and all my others competitors have the keyword on their domain, but not for my URL.Since I can't change my domain for fixing this suggestion, I would like to know what do you think about doing a 301 redirect from / to mydomainname.com/keyword/So the index of my website would be the /keyword.I don't know if this can make a damage to my SERP for the big change ir it would be a great choice.
On-Page Optimization | | estebanseo0 -
URL question
When we type in the URL of www.JustBunkBeds.com on firefox we end up with (S) in URL https://www.justbunkbeds.com/ When we type in the URL of www.JustBunkBeds.com on Explorer we end up with http://www.justbunkbeds.com/ Appreciate answer to this question Tony
On-Page Optimization | | OCFurniture0 -
Modify URL, how to re-index
hello, I have just modified URL, do I need to re-submit sitemap or something else to search engines?
On-Page Optimization | | JohnHuynh0 -
Cononical URL problem
Hello, In the keywords difficulty tool, one of my client's sites has a different number for links to root domain and links to page even though they're both the home page. How do I tell if I have a cononical URL problem, and what do I do about it if I do? Thank you.
On-Page Optimization | | BobGW0