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 -
Redirected pages still sending response code 200
SEO Moz tool reports missing title tags on all the links that have been redirected. E.g. this page: http://www.imoney.my/ms/personal-loan When I check the response code on the page with redirect checker it shows code 200 (page exists). Has it happened to anyone else? How can a redirected page send a 200 code?
Moz Pro | | imoney0 -
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 -
4xx status code a page that cannot be accessed..
All the error is because the Danish letters "åøæ" in the url.. But i can access all pages, therefor the error isent a true error!!! Why is it an Issue, Google can read "øæå", why cant SEOMOZ??
Moz Pro | | seopeter290 -
How to rank each page correctly in the search engines
Hello everyone, I am new to SEOmoz and SEO in general. I am trying to wrap my head around everything and one of the issues I am having trouble grasping is how each individual page on our website plays into ranking for certain keywords. I will explain in more detail below: 1.) We are not a blog, we have a pretty static website. 2.) We can add as many pages to our website as needed (for SEO purposes) 3.) Our site is fairly small, about 25 pages on the website. Now with that information above, here are our main questions & concerns: 1.) What is the best way to rank in the search engines for 50 of our best converting keywords with only 25 pages on our website? 2.) We have 2-3 competitors that rank in positions 1-3 for about 30 of our keywords we are trying to rank for. But no matter what you type in, for example, "cars" "buy cars" "buy a car online" "truck prices" etc, the results that the search engines display our their homepages. Not the other pages on their websites that actually rank for each one of those individual keywords. Is this normal? That is something that we would like for our rankings to do if we have any control over it. 3.) Should each page try to rank for a unique individual keyword? For example, when using the SEOmoz On-page Optimization tool, should I try ranking 2 pages for "buy cars online" or just 1 page? Say my homepage has an "A" grade for the keyword, "buy cars online" but so does my second page on my website. Are these pages essentially competing with each other? Or will the search engines pick their favorite page and display the one they like the best? Any help is greatly appreciated and I look forward to getting this cleared up. Thanks
Moz Pro | | threebiz0 -
I want to hire someone to write some PHP code using the SEOmoz API.
...but I'm not sure how to go about it. What I need is simple: all I want is to be able to paste a list of URLs (different domains), and have the program return the Page Authority for all those URLs. I understand I can use the free SEOmoz API, particularly the URL Metrics API. Then I want to export the data to an Excel file. That's it. Problem is, I have absolutely no clue how to do it. Obviously I'd pay someone to do it. Pay very well if you can do it professionally and quickly. How can I go about finding the right person for the job? Apologies if this is not the right place to ask this, but I don't know where else to go. Thanks.
Moz Pro | | thegreatpursuit0