Correctly Manage Your Preferred Domain

By Niklas Nordlof on Thursday, July 31, 2014

Correctly Manage Your Preferred Domain

If you have a website, then you must decide what whether to include the www or not: example.com or www.example.com. The shorter, modern trend is to drop the www—like twitter.com. But some sites still cling to the old style—like www.linkedin.com.

Whichever form you pick, setting up how the two addresses interact is essential to how search engines index your site.

The problem

Ideally, when someone types in www.example.com they should see the same site as the folks who type in example.com. That is simple enough if you’re dealing with just people. Once you throw search engines into the mix, the problem gets complicated.

Most humans won’t notice the difference between www.example.com and example.com. But if the two addresses are not set up to interact properly, search engines will perceive them as duplicates of the same content. Once that happens, SEO rankings and traffic will go down. (For more information about why, check out Moz’s article: What is duplicate content?)

The wrong solution

For example, many registrars create a CNAME record to handle this situation by default. So if people go to www.example.com, the record just sends them to example.com. This solution helps people get to the right place, but it causes search engine confusion.

With a CNAME record, both URLs are completely valid. But search engines want to know which URL is preferred. With multiple valid URLs, search engines see duplicate content.

The right solution

According to Google, the proper way to handle this is with a 301 redirect. A 301 redirect tells servers to update their records to the new address. That way, search engines know which version is valid. 

And most importantly, from your visitors’ perspective, everything works as expected. They can type in either www.example.com or example.com.

Here’s how to set up a 301 redirect:

  1. First, sign into your domain registrar’s site.
  2. Go to the page that allows you to update DNS records. This page should be called something like Domain Zone File, Manage Your Domains, or DNS Manager.
  3. Find your registrar’s URL Forwarding section, and start creating a new subdomain redirect. For some registrars, this is a separate tab. For others, it’s just separate section.
  4. Once you’ve started creating the redirect, you should see a Subdomain or Domain field. Enter www into this field.
  5. Next in the Forward to URL field, enter your domain name (example.com).
  6. Set the type of redirect as a 301 Redirect, and then save. You might see other fields like Meta Tags and Title. Leave those blank.
The top image shows what adding a redirect looks like for Name.com. The bottom image shows the process for GoDaddy. Your registrar should have similarly named fields.

That's it. Depending on a variety of factors, sometimes these changes can take up to 72 hours to propagate. Usually though, you’ll see the changes within an hour or two.

For more information on this process and how to set up a custom domain on Moboom, see Custom Domain in the Moboom Manual.

Tell Google which you prefer

Besides setting up 301 redirects, you can tell Google which domain you prefer (with www or without). To do this, sign up for Google Webmaster Tools, verify that you actually own both domains, and then select your preferred one.

First, create a Google Webmaster account and verify one domain:

  1. First, create a Google Webmaster account, and then add your site's URL (either with www or without—you’ll add the other version in a minute). Google will ask you to verify that you own the site by making a specific change, and you will see a several different methods that you can use for verification.
  2. Verify with a meta tag, so on the Alternate methods tab, click HTML tag. You will see instructions describing how to insert the meta tag. Don't worry about the instructions—Moboom has already taken care of the details.
  3. Copy the code in the content property (it will look something like X1x1xXtBrd-27cxfR_RyYJd9fVAOdi1XDP1dV5x1dOs).
  4. Back on your Moboom site, open your site, and then on the left menu, click Settings
  5. Next, paste the code into Google Webmaster Tools Verification Meta Tag, and then click Save Settings
  6. Back on your Google account, click Verify to add your site.

Next, add the other version of your domain:

  1. Go back to the Google Webmaster homepage, and click Add A Site.
  2. Enter the other version of your domain (either with www or without—whichever version you didn’t add earlier).
  3. Now verify this site using the same method as before. When adding the meta tag to your Moboom site, just overwrite the previous meta tag.

Finally, tell Google which version to use:

  1. Now select one of your sites (either the one with www or the one without).
  2. Click the gear icon in the upper-right, and then select Site Settings.
  3. Under Preferred domain, select your preferred URL, and then click Save.

That’s it. Google now knows for sure which version of your site to use in search results. For more information on setting your preferred domain, see Google’s instructions.


DevKit Templates

Find the website template you want in the Moboom Market