What is the correct htaccess code for Canonicalization?
-
I've been working on a clients site and put up the following but when I check back on seomoz i have over 3000 errors and notices and its been crawling a silly amount of pages that don't exist!!
ErrorDocument 404 /404.html
Options +FollowSymLinksDirectoryIndex index.html RewriteEngine OnRewriteBase / RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index.html\ HTTP/ RewriteRule ^index.html$ http://hiperformanceautocentres.co.uk/ [R=301,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.html [L]
-
It would be a good starting place for sites that are created in a similar way.
-
Should this basically be the htaccess starting point for every website that I create going forward?
-
Thats great thanks for that Chris.
-
This basically says change anything ending index.html to end / using a 301 redirect
<code>RewriteCond %{THE_REQUEST} ^.*\/index\.html?\ HTTP/</code>
<code>RewriteRule ^(.*)index.html?$ "/$1" [R=301,L]</code>
This says redirect anything that starts http://www.domain...... to just http://domain......
<code>RewriteCond %{HTTP_HOST} ^hiperformanceautocentres.co.uk [NC]``` RewriteRule ^(.*)$ http://www.hiperformanceautocentres.co.uk/$1 [L,R=301] ```</code>
-
Okay then you want
ErrorDocument 404 /404.html
Options +FollowSymLinksDirectoryIndex index.html
<code>RewriteEngine on</code>
<code>RewriteCond %{THE_REQUEST} ^.*/index.html?\ HTTP/</code>
<code>RewriteRule ^(.*)index\.html?$ "/$1" [R=301,L]</code>
<code>RewriteCond %{HTTP_HOST} ^hiperformanceautocentres.co.uk [NC]```
RewriteRule ^(.*)$ http://www.hiperformanceautocentres.co.uk/$1 [L,R=301] -
oops - guess i've knackered this page with that code!!
Could you explain what all the code means in detail? I just copied and pasted the original!!
-
-
You haven't redirected www and non www so you need to add:
RewriteCond %{HTTP_HOST} ^hiperformanceautocentres.co.uk [NC] RewriteRule ^(.*)$ http://www.hiperformanceautocentres.co.uk/$1 [L,R=301]
What other errors are you getting? 3000 seems a lot!
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
-
302 Status Code for .com but 200 Status Code for .com/
I ran a moz crawl report for one of my sites. For mywebsite.com I'm getting a 302 HTTP Status Code but for mywebsite.com/ I'm getting a 200 HTTP Status Code. mywebsite.com -Title tag "blank" - Meta Description "blank" - HTTP Status Code "302" - Referrer "blank" - Content Type Header "blank" - 301/302 target "/" - Rel-Canonical Target "blank" mywebsite.com/ - Title tag "correct tag" - Meta Description "correct tag" - HTTP Status Code "200" - Referrer "mysite.com" - Content Type Header "text/html" - 301/302 target "blank" - Rel-Canonical Target "mysite.com/" Will this cause any issues with the search engines? Is there a way to fix this? I'm on wordpress and use Yoast SEO premium plugin. I have sites ranking in many different niches and have done similar white hat SEO for all of my others. They are ranking in competitive niches but for some reason this site is in the 200-300s for basically all keywords in not a very competitive niche. It has excellent content, links and no penalties. I'm trying to find anything that could be the cause of this. Thanks! <colgroup><col width="64"></colgroup>
Moz Pro | | cccreationsinc
| Rel-Canonical Target |0 -
After I make corrections of my crawl diagnostics report, how can I tell is those corrections "took". Is there a way to immediatly refresh that report. Will it eventually refresh?'
I have made corrections to the crawl diagnostics report. Can I refresh this report? I would like to see if my corrections were correct. Thanks for your anticipated answer!
Moz Pro | | Bob550 -
Magento, SEOMOZ Toolbar not showing my HTML text, just shows CData code...
When I use the Mozbar on my homepage http://bootsjeansandleathers.com it just shows: // where it should show the HTML text of the page....anyone any ideas? Does this mean Google doesn't read my HTML text on the page!? Many thanks! mozbar.png
Moz Pro | | ebowdublin0 -
How exactly can I measure SEO - the correct way?
Hi, A very challenging questions I always ask myself is that how exactly do I measure SEO. I am writing content, building pages, correcting links and so on. So now how I measure as to what I am doing is this really working out for me? Are the content which I am building is it working for the benefit of my website etc. What tools can I use to measure SEO specifically. What factors should I look at to measure when in cases where I am just begun my seo strategy. Could anyone highlight the correct tools and where inside these tools or which features inside those tools could give me good measures of the SEO Implementation. Thanks
Moz Pro | | shanky10 -
'Appropriate Use of Rel Canonical', Critical Factor but appears correct on page
Hi, Trying to get the following page ranked unsuccessfully.... http://www.joules.com/en-GB/2/Collections-Quilted-Jackets/c01c02.r16.1 Instead a product page is being ranked, shown below.... http://www.joules.com/en-GB/Womens-Quilted-Jacket/Navy/M_HAMPTON/ProductDetail.raction When I run the on page report card it advises that the Rel Canonical tag needs to point to that page, but we have checked and it looks to be doing that already. Has anyone else had an issue like this? Thanks, Martin
Moz Pro | | rockethot0 -
SEOmoz not displaying correct amount of links?
When I go to the link analysis page where ti shows how many links my site has and how many my competitors have...it shows that I have 0 links. But Google Webmaster Tools shows my site as having 149 links. Is this a glitch with zeomoz or whats going on? The reason I initially subscribed to seomoz was to track my links. Thanks
Moz Pro | | tarik30010 -
Ranking Tracker not correct?
Over the last 6 weeks I've been linkbuilding for one of my customers. The search term is: bed and breakfast portugal. It is not easy but we are making progress. The goal is the number 1 page (top 10 results) in Google.nl I've been keeping score with Rank Tracker and also created a campaign. Last week we were still ranked 11 (for some time already) according to Rank Tracker but tuesday we made a jump to number 7. Whoehoe you would say but opening up Chrome and Firefox browser I am still seeing www.bedandbreakfast-casaceedina.com on the 2nd page? Maybe somebody can give me an explanation? I've de-personalized my search and also Rank tracker show s the command they are using: http://www.google.nl/search?q=bed+and+breakfast+portugal&pws=0 However also using that I'm not seeing my client back at position 7. How can the Rank tracker information be so wrong, I was hoping not off course 🙂 Your help is appreciated very much.
Moz Pro | | newtraffic0 -
Why would Open Site Explorer say some internal links are images when in the source code they're text?
Hi, All! I was looking at OSE for one of my client's site's pages, and I saw that all internal links were said to be images. I was pretty sure their menu was CSS, and all the links were text. So I did "fetch as Googlebot" and looked in the resultant code of one of the homepage to see the main navigation bar. The navigation link for one of those pages looked like this: `onmouseover="doMenu2on(this);">[](http://www.mysite.com/solution_sub.asp?ID=8)` [``` <code>![](images/arrow6.gif)Anchor Text Here</code> ```](http://www.mysite.com/solution_sub.asp?ID=8) ``` The nav link for a page that does show internal anchor text in OSE looks like this: onmouseover="doMenu2on(this);">[](http://www.mysite.com/solution.asp?ID=5) [```
Moz Pro | | debi_zyx
<code>Anchor Text Here</code> So there is an image in the link (it's the little arrow before the text to indicate a sub-category), but the anchor text comes right after it. Is Linkscape (and therefore potentially Google) seeing them as two different links to the same page and only counting the first? But it's all wrapped within the same <a></a>tags. Any ideas on if this is a bug in Linkscape, or a real issue, and what should be done? Thanks! Aviva``0