Friday

How to Fix URL Canonicalization

Search engines consider URLs with and without "www" as two different websites. Test your site for potential URL canonicalization issues. Canonicalization describes how a site can use slightly different URLs for the same page (for example, if http://www.example.com and http://example.com displays the same page but do not resolve to the same URL). If this happens, search engines may be unsure as to which URL is the correct one to index.

Solution:

In order to pass this test you must consider using a 301 re-write rule in your .htaccess file so that both addresses (http://example.com and http://www.example.com) resolve to the same URL.
- If you want to redirect http://www.example.com to http://example.com, you can use this:

RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^/?$ "http\:\/\/example\.com\/" [R=301,L]


- If you want to redirect http://example.com to http://www.example.com, you can use this:

RewriteCond %{HTTP_HOST} !^www.example.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]

Note that you must put the above lines somewhere after RewriteEngine On line.

Learn more about canonicalization issues at: http://www.mattcutts.com/blog/seo-advice-url-canonicalization/

3 comments:

  1. This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free. marketing1on1.com professional-seo-services-company

    ReplyDelete
  2. I just couldn't leave your website before telling you that I truly enjoyed the top quality info you present to your visitors? Will be back again frequently to check up on new posts. internet marketing services pricing Bend

    ReplyDelete
  3. Please continue this great work and I look forward to more of your awesome blog posts. Canada Visa from United States

    ReplyDelete