Quick SEO Tip: Set Preferred Domain in Google Webmaster Tools
By Monji in Tutorials23 CommentsThere are a few quick fixes you can apply to your site that can help boost your search rankings. If you haven’t already done these, take a break from what you’re doing and do this first – the results will be well worth the 10 minutes it will take.
Use Either WWW or No-WWW
Search engines treat each sub-domain, including www, as a different website altogether. This means that if your content is accessible via www and without it, both will be crawled and ranked in search engines. This will hurt your overall page rank (effectively splitting it) and reduce the number of backlinks to your domain. Be decisive – pick one or the other and configure your website to redirect traffic there.
The technique varies depending on your web server, but here are a few quick methods:
Using Apache
First, make sure you have mod_rewrite installed and enabled. Then create or modify an .htaccess file (in your directory root) and enter the following:
Redirect to WWW
1 2 3 4 | RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC] RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301] |
Redirect to No-WWW
1 2 3 4 | RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !^domain.com$ [NC] RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301] |
Using Lighttpd
Edit your site configuration, which is either your /etc/lighttpd/lighttpd.conf file or virtual host file (usually in sites-available), and add:
Redirect to WWW
1 2 3 | $HTTP["host"] =~ "^www\.(.*)" { url.redirect = ( "^/(.*)" => "http://%1/$1" ) } |
Redirect to No-WWW
1 2 3 | $HTTP["host"] =~ "^domain\.com$" { url.redirect = ( "^/(.*)" => "http://www.domain.com/$1" ) } |
Using nginx
Edit your site configuration, which is either your /usr/local/nginx/conf/nginx.conf file or virtual host file (usually in sites-available), and add:
Redirect to WWW
1 2 3 4 5 6 7 8 9 | server { server_name domain.com; rewrite ^(.*) http://www.domain.com$1 permanent; } server { server_name www.domain.com; # Enter your configuration info here } |
Redirect to No-WWW
1 2 3 4 5 6 7 8 9 | server { server_name www.domain.com; rewrite ^(.*) http://domain.com$1 permanent; } server { server_name domain.com; # Enter your configuration info here } |
Using Windows
I personally have zero experience using Windows servers, however I did find this article by Electric Media that may help. There are also a few forum posts that may shed some light into the matter.
Set Preferred Domain
Using the incredibly useful Google Webmaster Tools, you can set a preferred domain for your website that Google will favor in rankings. One useful bit of information is that you must verify both www.domain.com and domain.com to be able to select a preferred domain. This took me a little searching to figure out but it makes sense – Google does really treat different sub-domains, including www, as different websites.
You can find the Preferred Domain setting under Site Configuration -> Settings in your domain settings.
Final Words
It takes less than 10 minutes to implement www/no-www on your website and set a preferred domain – if you haven’t already done so, do it ASAP! This will help improve your search rankings and will make sure you’re not penalized for duplicate content, and the results are simply well worth the time.
If you have any other quick SEO tips or suggestions, please leave them in the comments. If you haven’t already, subscribe to the RSS feed and follow us on Twitter!








Not all of us use LAMP servers. How about a tip for those of us who use Windows servers?
Hey Phil, thanks for the response. Since I only have experience with LAMP servers, I used those in my examples. I was able to find only one decent reference to setting up redirects on Windows servers, and it seems to suggest using DNS records to accomplish the redirect.
Not sure if this helps but take a look at:
http://forums.iis.net/p/1148516/1865781.aspx
You might also be able to use a 301 redirect from your ASP application too:
http://markmail.org/message/nrq2qkoj643paulk
Found it! Hope that helps!
If I already do the redirect, do I still need to set a preferred domain?
This comment was originally posted on Hacker News
I did, and I think it can only help (it certainly can’t hurt to). The main scenario I can see this being of importance is if you recently started redirecting to a single domain and Google has previously crawled your site, setting a preferred domain may help to regain your page ranking.
This comment was originally posted on Hacker News
I did, and I think it can only help (it certainly can’t hurt to).
This comment was originally posted on Hacker News
Are there any relative merits to standardizing on a www sub-domain versus standardizing on non-www sub-domain?
This comment was originally posted on Hacker News
There was a huge debate on this a few years back, however most of that seems to have died down now. Matt Cutts discussed it a few years ago: http://www.mattcutts.com/blog/seo-advice-url-canonicalizatio…I think it’s a matter of personal preference – just be consistent with whatever you pick.
This comment was originally posted on Hacker News
Good tip, thank you very much
Thanks Steve, much appreciated!
I admire your blog , it’s filled of lot of information. You just got a perennial visitor of this site!
Thank you, that means a lot!
great article, thumbs up!
Thanks, I appreciate it!
Bear in mind that many common people(users) was teaching and know that all web address should be written with www
They will always write in with www
Only advanced users know that web address can be without www
So, there is no point to redirect from www to non-www, that is unnecessary and superfluous redirects
Regards
Alex
Check out the giants of IT industry like apple.com and adobe.com
How do you think why are they redirecting on a full address?
Are they so stupid?
Regards
Alex
Here is an useful article – http://googlewebmastercentral.blogspot.com/2006/09/setting-preferred-domain.html
i just changed my preferred domain to www. this is an interessting thing.
so now whether we use www or non www it will only see it as www?
hello, i was initially using “no preference” but having gone through your tutorial i changed my mind a turned my blog webhealthcare.info to http://www.webhealthcare.info
i think now i may get better result from Google
lol
Definitely go with one or the other (never both)!