The solution is a two part fix. The first leg involves setting up Google Webmaster Tools. After you verify your sites (both the www and non-www). Go to Site Configuration > Settings > Preferred Domain and set it to "Display URLs as www.example.com"
Part two of the solution is to set up a 301 redirect and you can do that by adding the code below to your .htaccess file:
# non-www to www
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [R=301,L]
To learn more, read up on more on 301 redirects.
After all this, it'll take a while for google webmaster tools to take effect. Apparently, it takes weeks for Google Webmaster Tools Blog to configure itself. You can learn more about the process at the tools.
------
NOTE: WORDPRESS USERS:
For WordPress Users, you will also need to change a setting in wordpress general settings and set your preferred URLs to have www.
No comments:
Post a Comment