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
-
Error Code 804: HTTPS (SSL) Error Encountered
I'm seeing the following error in Moz as below. I have not seen any errors when crawling with different tools - is this common or is it something that needs to be looked at. SO far I only have info below. Assuming I would need to open a ticket with hosting provider for this? Thanks! Error Code 804: HTTPS (SSL) Error Encountered Your page requires an SSL security certificate to load (using HTTPS), but the Moz Crawler encountered an error when trying to load the certificate. Our crawler is pretty standard, so it's likely that other browsers and crawlers may also encounter this error. If you have this error on your homepage, it prevents the Moz crawler (and some search engines) from crawling the rest of your site.
Moz Pro | | w4rdy0 -
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 -
Keyword Difficulty Tool Full Reports - Are they correct?
Hello SEOMOZ Community I hope you can answer my following question. I’ve used the Keyword Difficulty and SERPS to analyse why my competitors seem to be higher than me in the SERPS for a certain keyword. The only problem I can see when I’ve done the full report is that our website has no internal links to the page we are trying to rank for, however when I go into Google webmasters tools it’s stating we have over 99,000 links. Can you please let me know why this is showing in the report? Many Thanks Matt
Moz Pro | | Steve250 -
'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 -
To block with robots.txt or canonicalize?
I'm working with an apt community with a large number of communities across the US. I'm running into dup content issues where each community will have a page such as "amenities" or "community-programs", etc that are nearly identical (if not exactly identical) across all communities. I'm wondering if there are any thoughts on the best way to tackle this. The two scenarios I came up with so far are: Is it better for me to select the community page with the most authority and put a canonical on all other community pages pointing to that authoritative page? or Should i just remove the directory all-together via robots.txt to help keep the site lean and keep low quality content from impacting the site from a panda perspective? Is there an alternative I'm missing?
Moz Pro | | JonClark150