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
-
Using the Same Word in Every URL
Just looking to get some opinions on this. Some coupon sites use "coupon" in all of their URLs - this is a practice I would avoid, as to me it is a little spammy. For example:
On-Page Optimization | | vanessakohl
.com/amazon-coupons/
.com/ebay-coupons/
.com/walmart-coupons/
... and so on for thousands of other brands. I don't think this is necessary, as Google will understand from the content, backlinks and the domain name (including the word "coupon") that brand pages are coupon-focused. Any other thoughts on this?0 -
Paginated URLs are getting Indexed
Hi, For ex: - My site is www.abc.com and Its paginated URLs for www.abc.com/jobs-in-delhi are in the format of : www.abc.com/jobs-in-delhi-1, www.abc.com/jobs-in-delhi-2 and vice versa also i have used pagination tags rel=next and rel=prev. My concern is all the paginated URLs are getting indexed so is their any disadvantage if these URLs are getting indexed as somewhere i have read that link juice may get distributed in case of pagination. isn't it good to use Noindex, Follow so that we can make the Google to understand that paginated page are not so much important and that should not be ranked.
On-Page Optimization | | vivekrathore0 -
Indexed/Submitted URLS vs Total Indexed
Hello, My site is www.colbysphotography.com. I have Total Indexed 195 while I have 87 URLs submitted and only 79 URLs Indexed. What is the difference and is there a problem? Thanks ahead of time,
On-Page Optimization | | littlecolby
Colby0 -
Mixing hyphens and underscores in a url
Hello. I am working on a site that was built with underscores in the urls, but only in the page names, not in the subdirectories. All the subdirectories have one-word names. So a typical url is "example.com/sub1/sub2/page_name." We would like to change the name of one of the subdirectories to a name that would be very useful for SEO, but this new name is a hyphenated word, let's call it "new-sub." If we changed "sub2" to "new-sub" then our url would have a mix of underscores and hyphens: example.com/sub1/new-sub/page_name. But if I used "new_sub" instead, google would read the words as connected with an underscore, instead of reading the subdirectory as a hyphenated word, which would be less useful for SEO. It seems like it might be a problem to have a hyphen in a subdirectory and underscores in the page names. But I want the SEO value of the hyphenated word. Any recommendations? Thank you!
On-Page Optimization | | nyc-seo0 -
Tag-URLs in Magento
Hello, I have got a problem concerning Tag-URLs in Magento (the URLs mentioned are just fictitious 😞 At the moment, they look something like this: (1) http://store.com/tag/product/list/tagId/1/ ... so these URLs are not search engine friendly at all. Using a Magento extension you could transform them in speaking URLs: (2) http://store.com/tag/digital-cameras What would you do if you sold, say, digital cameras and your online shop ranked high for the keyword "digital camera" with URL No. 1 (not search engine friendly). Would you transform (1) in (2) and 301 all non speaking URLs? But would you keep the high ranking for "digital camera" when 301 to URL No. (2). But, what I'm most concerned of is : There is actually a landing page (category page) for the keyword "digital camera" : http://store.com/digital-cameras. Shouldn't the last URL rank high for "digital camera"? (instead of the tag URLs). But given the situation above, does it make sense now to 301 the tag URL to the category page? I would perhaps lose my good ranking, wouldn't I? Thanks a lot for your help! Martin
On-Page Optimization | | SmartyMarty810 -
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 -
Ecommerce Product Subcategory URL
Our website has 5 main categories displayed in tabs in the header. The main landing page of each of the 5 categories is a paginated page (3pages- set up with canonical tags to avoid duplicate content) with a side bar which splits the main category into many subcategories. Each of these subcategories essentially filter the main landing page into more defined categories customers find useful (price/colour) BUT once clicked enter into a separate landing page. We have worked hard to avoid any duplicate content issues between these sub-landing pages and the main landing page. This was done as we wanted each of the subpages to organically rank (thus we went with this method rather than filters). Hope we didn't do the wrong thing there? The question is should these sub-landing pages route straight from home to have the best chance to get individually ranked or routed through the main category bearing in mind we have 5 main categories each with many subcategories. i.e. domain.co.uk/subcategory or domain.co.uk/category/subcategory Thanks in advance for any advice given.
On-Page Optimization | | jannkuzel0 -
Is having the word catalog in an ecommerce site url detrimental to seo.
IS: www.example.com/catalog/category%/product% better than www.example.com/category%/product% category and product are dynamic values that change with the diff. categ. and products displayed while catalog is constant.
On-Page Optimization | | no6thgear0