Quick SEO Tip: Set Preferred Domain in Google Webmaster Tools

There 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

Setting Preferred Domain in Google Webmaster ToolsUsing 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!

  • Pingback: Quick SEO Tip: Set Preferred Domain in Google Webmaster Tools … | webmaster

  • http://www.netinspired.com/ Phil Rae

    Not all of us use LAMP servers. How about a tip for those of us who use Windows servers?

    • http://devgrow.com/ Monji

      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

    • http://devgrow.com/ Monji

      Found it! Hope that helps!

  • Pingback: Quick SEO Tip: Set Preferred Domain in Google Webmaster Tools … | Really Simple Syndication

  • http://www.mynext.co.uk steve

    Good tip, thank you very much

    • http://devgrow.com/ Monji

      Thanks Steve, much appreciated!

  • http://www.emarketingatlanta.net/ Atlanta Online Marketing

    I admire your blog , it’s filled of lot of information. You just got a perennial visitor of this site!

    • http://devgrow.com/ Monji

      Thank you, that means a lot!

  • Pingback: SEO-Tutorial: Standard-Domain festlegen = maximale Linkpower » t3n News

  • http://www.linkjuice.at Backlinkservice

    great article, thumbs up!

    • http://devgrow.com/ Monji

      Thanks, I appreciate it!

  • Alex

    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

  • 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

  • Alex
  • http://makemoneyonlineyo.com faiz

    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?

  • http://www.webhealthcare.info manidip bandyopadhyay

    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

    • http://devgrow.com/ Monji

      Definitely go with one or the other (never both)!

  • Karl R

    Hi,

    Primarily I come from a Linux server background and thus encountered problems with not being able to use .htaccess when my company purchased a Windows Server.

    However, I found a great application by Helicon called APE —>http://www.helicontech.com/ape/
    This allows you to implement .htaccess on a Windows Server.

    Enjoy.

    Thanks.

  • http://bernardtips.com Bernard Tips

    Thank you.

    Adding “www.” and “without www.” made the trick.

    I was trying for half an hour to set the preffered domain but didn’t worked.

    Thanks again.

  • http://www.successfulsite.com Portland SEO

    Thanks for the tips. These are really useful.

  • http://www.nicecarvings.com jason

    Awesome! I just did this and wished I had sooner but just became aware today that I should. I searched how to do it and this blog post came up.

    How long before I see the boost in rankings? lol

    I went from no preffered (which is default, right?) to preffered of www

  • http://dvuk.net Richard

    Hi Monji,

    Thanks for explaining this little gem.

    I have a quick question though. I have a main domain with a number of add-on domains and my hosting provider uses cPanel. So my .htaccess file contain a number of entries, like this:

    RewriteEngine on

    RewriteCond %{HTTP_HOST} ^drunkenthumbs.co.uk$ [OR]
    RewriteCond %{HTTP_HOST} ^www.drunkenthumbs.co.uk$
    RewriteRule ^/?$ “http\:\/\/drunkenthumbs\.com” [R=301,L]

    RewriteCond %{HTTP_HOST} ^autocentrechorley.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.autocentrechorley.com$
    RewriteRule ^/?$ “http\:\/\/autocentrechorley\.co\.uk” [R=301,L]

    As you can see, the format is slightly different to what you have, should I change it to reflect yours, or leave it as is (just removing the extra line I don’t need)? Also, do I need the statement RewriteBase / once for each domain, or just once at the top of the file?

    Thank you.

    Richard.

  • http://www.kudosnetwork.co/ Kudos Network

    Hi.. very good info here … tho I’ve got a noob question …..
    I dont have to add a sitemap to this second verified domain, do I? :-D

    This is my .htaccess file – does it look ok?, I already had a 301 redirect set up, but the code is a little different to yours – anything bad in there?:
    ———–

    RewriteEngine on
    # -FrontPage-

    IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

    order deny,allow
    deny from all
    allow from all

    order deny,allow
    deny from all

    AuthName kudosnetwork.co
    AuthUserFile /home/kudosnet/public_html/_vti_pvt/service.pwd
    AuthGroupFile /home/kudosnet/public_html/_vti_pvt/service.grp

    RewriteCond %{HTTP_HOST} ^kudosnetwork.co$
    RewriteRule ^/?$ “http\:\/\/www\.kudosnetwork\.co” [R=301,L]

    ———–
    Any help much appreciated.. =]

  • http://mirolta.com Minesh Rai

    I want to set, but don’t know which one to set www or non-www. Plz tell which one is better

  • http://www.kudosnetwork.co/ Kudos Network

    @Minesh Rai…. Well it doesn’t much matter

    Monji wrote:
    “Definitely go with one or the other (never both)!”

    WWW … kinda looks better to me…. I just went with that.

  • http://ancyta.wordpress.com/ Ancy

    Hi

    I have a website without www now i have redirected it to http://www.example.com, now will google crawl my site, is there any thing i have 2 do with preferred domain settings?

  • http://bt-internet.co.uk/ BT Internet

    “Hi

    I have a website without www now i have redirected it to http://www.example.com, now will google crawl my site, is there any thing i have 2 do with preferred domain settings?”

    If you specify your preferred domain as http://www.example.com and we find a link to http://example.com, we’ll consider both links the same.

    …whereas if you don’t specify WWW as preferred .. Google may see it as two separate sites, which is not good, as it would seem to google that there is duplicate content – which is bad.

  • Pingback: 6 Prefered Domain Sites | Best Hosting Companies

  • Anu P

    I use Google webmaster tool and I never used the Bing one. I’m not sure that the results would reflect the big market performance since Bing has a small part of it.

    song

  • http://www.nittanyweb.com/ PA Web

    Is there a place in Bing Webmaster Tools to set a preferred domain?  Thanks!

  • Techteem

    nice post, It really helped me alot I used all the above step on my tech blog http://www.techteem.com and it really boosted my search ranking, thanks for the nice tips

  • http://www.webretailgroup.com/ Ecommerce Guys

    Great tip.  One that has proven useful for us!  

  • http://www.webretailgroup.com/ Ecommerce Guy

    Agreed!  We used www as the preferred domain.  

  • Rob

    Hi there,

    I just checked with my hosting service and asked them for help in doing that. the answer:

    “Thank you for getting back to us.

    I have just checked and the website is already redirecting from: 

    http://sportsaudios.com

    to:

    http://www.sportsaudios.com

    You may make such redirects via your cPanel -> Redirects.”

    I know that when I type in the first one it apparently re-directs to the other. Does that mean that also for indexing purpose the redirect is taking effect?
    thanks