Question

I have a site and am using Google Webmaster tool. I created the setting within the tool for the site twice: once as www.xyz.com and once as xyz.com. The statistics from both are different once I drill down into details.

I want to stick with www.xyz.com. How can I make everyone go to xyz.com be redirected to www.xyz.com? and will this harm my ranking or indexing in google?

regards,

sorry if the question is simple :)

Was it helpful?

Solution

with htaccess, i use the following for forced www

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

although you might be best doing the following if if it is for SEO purposes

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

RewriteCond %{THE_REQUEST} ^.*/index.php 
RewriteRule ^(.*)index.php$ http://%{HTTP_HOST}/$1 [R=301,L]

RewriteCond %{THE_REQUEST} ^.*/index.htm
RewriteRule ^(.*)index.htm$ http://%{HTTP_HOST}/$1 [R=301,L]

RewriteCond %{THE_REQUEST} ^.*/index.html
RewriteRule ^(.*)index.html$ http://%{HTTP_HOST}/$1 [R=301,L]

RewriteCond %{THE_REQUEST} ^.*/home.htm
RewriteRule ^(.*)home.htm$ http://%{HTTP_HOST}/$1 [R=301,L]

RewriteCond %{THE_REQUEST} ^.*/home.html
RewriteRule ^(.*)home.html$ http://%{HTTP_HOST}/$1 [R=301,L]

as this also removes any index or home page part of the url.

in webmaster tools in settings, you can also select always use www, which will merge the data for both domains under a single www domain (although you will be able to see both www and non-www listed in GWMT)

OTHER TIPS

Use preffered domain, more instructions here:

http://support.google.com/webmasters/bin/answer.py?hl=en&answer=44231

Specify a preferred domain:

On the Webmaster Tools Home page, click the site you want.
Under Site configuration, click Settings.
In the Preferred domain section, select the option you want.

You could also use 301 redirect: http://support.google.com/webmasters/bin/answer.py?hl=en&answer=93633

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top