WWW or Not: That is the Question?


Most people don’t realize that there website can found by using both www.mywebsite.com and mywebsite.com. Why is this important? The search engines will index both the www site and the non-www site, providing the search engine an identical set of pages which could lead to a penalty. While most search engines will eventually sort this out why wait for them to do it. Don’t give them a choice in what they index.

Create a .htaccess file and place it on the web root folder. Include the following lines of code:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mywebsite\.com$ [NC]
RewriteRule ^(.*)$ http://www.mywebsite.com/$1 [R=301,L]

This will redirect all requests for pages at mywebsite.com to www.mywebsite.com giving only one copy of your website for the search engines to index. Give it a try on this blog. All requests to blog.lgr.ca are redirected to www.blog.lgr.ca.

Categories: seo web-programming 
Comments