301 Redirect Your Hostnames - Technical SEo Vancouver
301 Redirect Your Hostnames – Technical SEo Vancouver

If you need to 301 redirect your hostnames to your preferred domain, we will show you what to do in this article. By redirecting your hostnames to your preferred domain, you will eliminate duplicate content on your homepage. By default, all websites have more than one homepage URL so we need to consolidate the homepage to one URL.

To leave all hostnames in tact can create duplicate content issues with search engines. Since the homepage is the most important page on your website, it is key to make sure that it is not duplicated. Duplicate content isn’t good for SEO as search engine see it as spam, so we need to make sure to eliminate duplicate content.

Why Do We Need to Redirect Hostnames? – Scoop Up all of Your Hard Earned SEO Value Over Multiple Homepage Variations to One Homepage

Another reason why you would want to redirect your hostname to a preferred domain is because people could be linking to different versions of your homepage. Each homepage may have a PageRank of 1, but if you consolidate PageRank (PR) across all of your hostnames by 301 redirecting them to your preferred version, then your homepage may be a PR3.

How Does Redirecting Hostnames Help to Consolidate PageRank

PageRank is seen as obsolete now but we believe it is still a sign of search engine trust because when we optimize websites with higher PR, search engines crawl, index and rank those sites much faster than websites with low or no PR. Even something like optimizing the metadata on a site with a PR3 can have huge positive ranking results, even without any other optimization. Once a website is at least a PR3, we get excited because we know that with a lot of hard work, and a couple of years, we can turn a PR3 into a PR6. Once you get to a PR6, you can put content up but won’t have to work as hard for it to rank, instead it becomes more of a maintaining keywords game. Let’s get back to the 301 redirects for hostnames though, shall we? 🙂

What Hostname Variations Do You Need to Consolidate?

There are some hostname variations that you want to check to see if your website has. Not all of these will apply to you, as they depend on what kind of a server setup you may have. Here are the most common hostnames we look for:

WWW Version – With and Without the Slash and File Type

301 Redirect non www to www
301 Redirect non www to www
  • www.site.com
  • www.site.com/
  • www.site.com/index.html
  • www.site.com/index.php
  • www.site,com/home.aspx

Non WWW Version – With and Without the Slash and File Type

  • http://site.com
  • http://site.com/
  • http://site.com/index.html
  • http://site.com/index.php
  • http://site,com/home.aspx

Convert / Force or Redirect http vs https – Non Secure Webpages to Secure Webpages

It is also important to mention that if your website uses https then you will need to redirect http to https in order to avoid duplicate content. The easiest way to check if your website is using both versions is to go to your website and add or remove https from the URL. If both http and https resolve then you have duplicate content and will need to redirect http to https. This will also help your rankings as search engines like to keep the web secure. Being https is a sign of trust as it ensures visitors that they are indeed accessing your website directly. Search engines favour http:// over https:// When your website is secure, it means that people are making a direct conenction to your website, and can freely browse, knowing that their connection to you is secure. There are different levels of security, from basic to advanced, which is also referred to as SSLEV or elevated SSL. SSL means secure socket layer if you wanted to know 🙂

.htaccess File – Code to Redirect Hostnames to Preferred Domain

Now, let’s get to the whole point of this article, here is the code you need to use to 301 redirect your hostnames for non www to www. The steps to implement are fairly simple.

  • Copy and paste lines 1-13 into notepad, removing the numbers 1-12
  • Change lines 11 and 12 to your website
  • Save as .htaccess
  • Upload to your server’s root
  1. #seocandyland.com – SEO Vancouver 604-779-8438
  2. RewriteCond %{HTTPS} !=on
  3. RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
  4. RewriteCond %{HTTP_HOST} (.+)$ [NC]
  5. RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]
  6. #Mod Rewrite
  7. <IfModule mod_rewrite.c>
  8. Options +FollowSymLinks
  9. RewriteEngine on
  10. RewriteCond %{HTTP_HOST} ^seocandyland\.com
  11. RewriteRule ^(.*)$ http://seocandyland.com/$1 [R=301,L]
  12. </IfModule>

Now check to see if this has been implemented correctly by typing in any of the above hostnames and seeing if they still resolve or if you see the www version of your homepage without the slash. If you want to actually see the verification of this working, you can check your website’s headers. If you see a 301, moved permanently, congratulations! If you don’t please contact us for help. Our contact information is at the bottom of this page.

Update Your Preferred Domain in Google Webmaster Tools

Google Webmaster Tools Search Console Preferred Domain
Google Webmaster Tools Search Console Preferred Domain

This is the last step in the 301 redirect your hostname to preferred domain task. Once you have signed into the Google Search Console / Google Webmaster Tools (GWT) , you will need to add all hostname variations to it and verify all of them. The easiest way to verify this is through Google Analytics. There are a few steps involved here, so if you aren’t sure how to do them, we can help. For those of you reading this that know how to use GWT, you will want to select the www version of your website without the slash by clicking the link. You will then need to navigate to the gear and click on site settings. Then choose to display www as your preferred hostname.

Here are a few bonus things you can do while you are logged into GWT:

  • Search Traffic > International Targeting > Country
  • Download your crawl errors
  • Download your content errors
  • Check Googlebot’s crawl and index – record if your index is low
  • Add your sitemap if it isn’t already added – or make one if you haven’t already done so

Contact Us for Help With the 301 Redirect Your Hostnames to Preferred Domain Task Today

It is important to 301 redirect your hostname to preferred domain, and we are here to help. If you haven’t had this done, or have, we can implement it, check to see if it was implemented correctly and make any necessary adjustments if need be. We understand that SEO gets technical sometimes and can quickly get your website back on track. If you need your hostnames redirected or have a lot of errors that need cleaning up, or maybe aren’t ranking like you want to, please contact us. We can be reached via email at info@seocandyland.com, by phone or text at 604-779-8438 or you can fill out the form at the top of this page. We look forward to helping you achieve success with your website.

About the Author

SEO Candyland

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

Want More Great Content?

Check Out These Articles 

>