How to Setup Preferred Domain www or non-www

by Frank Jovine on 12/06/2009 in SEO Tips

A www and non-www of the same domain are treated as two different URLs. You should maintain the consistency and should always use the same URL version.

When checking backlinks to your site, you may see two different results when using preferred and non-preferred domains (‘www’ or http:// without the www).

To specify your preferred domain

  1. Go to Google Webmaster Tools Home page, click the site you want.
  2. Under Site configuration, click Settings.
  3. In the Preferred domain section, select the option you want.

how-to-setup-preferred-domain

You may have to upload the verification html file from Google to your websites root directory to verify ownership. When you change your preferred domain, it will impact both crawling and indexing. In most cases, both versions point to the same physical location.

Note: Once you’ve set your preferred domain, you will need to use a 301 redirect to redirect traffic from your non-preferred domain. This will help other search engines and visitors know which version you prefer.

How to setup .htaccess with a 301

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

Need help? Please comment here and I would be glad to help.

  • Share/Bookmark

9 Responses to “How to Setup Preferred Domain www or non-www”

  1. BunnygotBlog

    Dec 6th, 2009

    I will tweet and su!

    • Frank J

      Dec 6th, 2009

      Bunny,

      You are so Tweet, I mean sweet. :)

  2. BunnygotBlog

    Dec 6th, 2009

    lol! Frank You are awesome!

  3. worship songs

    Dec 8th, 2009

    Very useful peace of information. Somebody once told me or I guess I read somewhere that it is better not to submit your site/blog to search engines just build backlinks. Search engines will find your site themselves. No need to upload sitemaps etc In this way search engines will list all your pages. I have tried this with a few of my sites and it works. Why use google webmaster tools and analytics when cpanel’s AWstats has everything.

    • Frank J

      Dec 8th, 2009

      No need to upload a sitemap is not true at all. You want to make it easy for Google to index your pages and a sitemap provides just that. Google Webmaster Tools provides more data that is crucial for SEO over AWstats.

  4. Hicham

    Dec 10th, 2009

    Frank,

    This is important step to avoid duplicated content since and it has a big name: “canonicalization” but let us step away from the big names and concentrat on the nice tips like this :) .

    If I may add something, you can double-check if the redirect is working using online tools like [Web-Sniffer]; if the response is 301 then everything is fine and you’re done

    Thanks for sharing :)

    • Frank J

      Dec 10th, 2009

      Hicham,

      Yes! It’s the little or subtle changes that make a difference.

      Thank you!

  5. Jessica Gottlieb

    Dec 12th, 2009

    Question, why would it matter if it’s with or without the www?

    • Frank J

      Dec 13th, 2009

      Jessica,

      It is because both can be treated as two different domains. It will also prevent duplicate content as both with and without the www will still have the same content.