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
-
Canonicals
I dynamically generated pages using rewrite functions in wordpress (new-york, san-diego, san-francisco). All these pages look the same but with different content. yoast (seo wordpress plugin) was unaware of this and set canonicals up relating to the wordpress page used as the template page for the dynamic pages (City_home_page). so all these pages had the canonical https://dinnerdancecruises.com/City_Home_Page. using search console, i saw google indexed my site, looked at all these dynamically created pages (which is about 30 pages) and took them all in as duplicate pages. this happen sometime in april or may. I fixed this problem and set unique canonicals up for each dynamically created page. but now google is not crawling them for some reason. im not sure why its been months and these pages are not indexed. i thought to myself is it because these links end up on multiple pages? sort of like having "terms of agreement" link at the footer. every single page has that terms of agreement link. does google look at those links as duplicates and not index the page at all. this is where my issue lies. i need google to crawl regularly and see those pages with their new, unique canonicals and re-index them correctly. but it seems to save cpu resources, google feels once a thief always a thief. i could be wrong but this is why i need your suggestion. thank you.
On-Page Optimization | | bobperez7360950 -
Potential new URL structure for my ecommerce site
At the moment my site suffers from a flat product category structure where over 600 items fall into one category alone. This category is then filtered using a faceted search which appends query strings to the category URL and changes the products displayed on the page. At the moment our product category URL is as follows, www.domain.com/category/greeting-cards and this holds all cards including occasions such as anniversary, birthdays etc and also themes such as animal cards, contemporary cards etc I have proposed changes to my developer to change this structure to include subcategories. I can now go two subcategories deep. For example, "greeting cards > occasions > birthday cards" or "greeting cards > themes > animals". This is reflected in the new URL structure, which has been proposed, www.domain.com/greeting-cards/occasions/birthday-cards. In this URL do I need "occasions" in the URL as I don't think it adds much value to the user? Would I be better of having www.domain.com/greeting-cards/birthday-cards. If a user searches for "birthday cards" then I think this would be more relevant?
On-Page Optimization | | joe-ainswoth0 -
Link flow for multiple links to same URL
Hi there,
On-Page Optimization | | doctecs
my question is as follows: How does Google handle link flow if two links in a given page point to the same URL? (do they flow link individually or not?) This seems to be a newbie question, but actually it seems that there is little evidence and even also little consensus in the SEO community about this detail. Answers should include source Information about the current state of art at Google is preferable The question is not about anchor text, general best practises for linking, "PageRank is dead" etc. We do know that the "historical" PageRank was implemented (a long time ago) without special handling for multiple links, as e.g. last stated by Matt Cutts in this video: http://searchengineland.com/googles-matt-cutts-one-page-two-links-page-counted-first-link-192718 On the other hand, many people from the SEO community say that only the first link counts. But so far I could not find any data to back this up, which is quite surprising.0 -
Is this canonical issue?
WP site has automated canonical on domain.com/ by Yoast plugin but there is URL (/?page=kontaktine-forma) where same domaim.com/ canonical tag was put on. I made 301 redirect to main page. Is this a good practice?
On-Page Optimization | | OVJ0 -
"On Page" report says 2 rel canonical urls-how do I fix that?
I am reviewing my On Page scores and I'm not getting a perfect score bk of this notice: No More Than One Canonical URL Tag Moderate fix <dl> <dt>Number of Canonical tags</dt> <dd>2</dd> <dt>Explanation</dt> <dd>The canonical URL tag is meant to be employed only a single time on an individual URL (much like the title element or meta description). To ensure the search engines properly parse the canonical source, employ only a single version of this tag.</dd> <dt>Recommendation</dt> <dd>Remove all but a single canonical URL tag</dd> <dd>HOW do I fix that?</dd> <dd>I am using Platinum seo plugin which I have checked "Use canonical urls" and the page in question is</dd> <dd>http://adderalldosage.net/general-adderall-dosage/</dd> </dl>
On-Page Optimization | | ccare7230 -
301 redirects / clean urls
hello everyone, we moved our site to a new platform that has url rewrite feature. we are building out a spreadsheet of the old aspx urls and the corresponding page on the new site. my dev tells me that its not important to redirect the old page to the new "clean url" page which sounds a bit odd to me ..example below. okay. so he says its the same difference to 301 redirect this url: http://72.3.181.97/catalog/DesignerDogBeds.aspx to this urls: https://www.k9electronics.com/product.php?productid=3474 instead of this clean url: http://www.k9electronics.com/designer-dog-beds/ can anyone give me any feedback on this? thanks!
On-Page Optimization | | k9byron0 -
Optimise duplicate products or canonical link
We exist in a niche market with a good % of products that sell well at specific times of the year. Lets say for example a red cup can be sold as a christmas red cup and a valentine red cup or just a red cup. Would we be best to optimize each specific product specifically for those seasons/events on different pages or keep google pointed to just one page using a canonical link.
On-Page Optimization | | LadyApollo0 -
On page Analysis... how does seomoz choose to match a keyword to a url?
On my "On Page" analysis report it show me a couple pages that have D ratings... one key phrase is "my destination lodging" and it is matching it up with a url like mydomain.com/my-destination-hotels.html. It says I'm ranking 37th for this term.... Is it just suggesting that I optimize this url because it is already ranking for that term? So should I create a different page with a different url to better match this phrase? Thanks for any ideas.
On-Page Optimization | | PillarMarketing0