BlueHost, Add-On Domains, and .htaccess

Jan. 06

As mentioned in my 2010 goals, I’m extremely excited about the domaining industry. My 2010 goals have me attending at least one major domaining conference in addition to developing at least six websites. (Honestly, I’m sandbagging a bit and hope to develop quite a few more websites than six.) Domaining and web publishing in my opinion are excellent ways to master SEO while building up some passive income. (You may wish to read my article about moonlighting your way to success in your PPC career.)

In today’s article, I’d like to feature a low level discussion on hosting multiple domains within a single web hosting account, a cost effective method for anyone to develop multiple websites this year. Specifically, I will be sharing my BlueHost story. I hope to save you the many hours it took me to figure out configuration of the .htaccess file to optimize SEO for add-on domains with BlueHost. Sound confusing? Don’t worry! I will explain in full detail below!

BlueHost Web Hosting

Why Sign Up For BlueHost?

Programming Matrix

BlueHost is a very trusted web host, one that I’ve heard great things about over the years. They are extremely reliable and moreover offer the ability to host multiple domains within a single account (with unlimited bandwidth) for only $6.95 per month (or possibly less if you have a coupon). This is a dream come true for all you domainers out there! So, I signed up and thought it would be super easy to instantly host multiple sites within one simple account.

As a side note, I’m a big proponent of online marketing diversification. As you publish more and more websites, it’s extremely important to go with multiple hosts and registrars. Looking to diversify, it made perfect sense for me to give BlueHost a try. In your quest to diversify, I recommend GoDaddy, BlueHost, and Host Gator on the hosting side. On the registrar side, I recommend GoDaddy and Moniker. As your side business expands, diversification mitigates risk of downtime.

BlueHost and Add-On Domain Confusion

Signing up for BlueHost with your initial domain is super easy. You point your nameservers to BlueHost, open an account, link in the domain, upload your website, and you’re done. When you want to start hosting an additional add-on domain, however, things can get a little tricky (but I will fully explain all the steps to make the process a breeze for you).

Specifically, BlueHost stores files for your add-on domain as a sub-folder of your main domain. For example, let’s say I have two sites, example1 (main site) and example2 (add-on site). All files for example2 will be in a subfolder under example1 (you can name the subfolder whatever you want but I recommend just keeping it simple and sticking to the site’s name).
http://www.example1.com/example2/

To make things even more confusing, BlueHost also makes example2 a subdomain of example1 (you can name the subdomain whatever you want but I recommend just keeping it simple and sticking to the site’s name).
http://example2.example1.com/

Of course, example2 will also function as a URL on its own.
http://www.example2.com/

SEO and Duplicate Content Do Not Mix Well

As you may already know, Google and other search engines hate duplicate content. The fact that your example2 website now shows up three times at three different URLs opens you up to all sorts of duplicate content issues. If Google indexes all three URLs, you will immediately have SEO problems.

However, this can all be prevented with the use of 301 redirects in your .htaccess file. 301 Redirects are the SEO friendly way to tell Google and other search engines that the files for your website have permanently moved to another location. Because you never intended to have a site at http://www.example1.com/example2/ or http://example2.example1.com/ you will clearly want to 301 redirect these two domains to http://www.example2.com/. As someone who has previous experience with .htaccess, I thought the 301 redirects would be a breeze in this case but they actually gave me a run for my money.

How To Configure Your BlueHost .htaccess Files For Add-On Domains

I’d like to close this article out with the actual code you’ll want to use in your .htaccess files, both the one in your root www folder for your main domain and the one(s) in your add-on domain folder(s). I first tired to leverage cPanel’s redirect GUI to make this happen, but it didn’t fully work. The code below is a combination of my use of cPanel’s GUI and my own trial and error.

Your Main Site’s .htaccess File

(In the following code, example1 is your main site and example2 is your add-on site.)

Options +FollowSymLinks
RewriteEngine On

Redirect 301 /example2/ http://www.example2.com/
Redirect 301 /example2 http://www.example2.com/

RewriteCond %{HTTP_HOST} ^example1\.com$ [NC]
RewriteRule ^(.*)$ http://www.example1.com/$1 [R=301,L]

Your Add-On Site’s .htaccess File

(In the following code, example1 is your main site and example2 is your add-on site.)

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{HTTP_HOST} ^example2.example1.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.example2.example1.com$
RewriteRule ^(.*)$ "http\:\/\/www\.example2\.com\/$1" [R=301,L]

RewriteCond %{HTTP_HOST} ^example2\.com$ [NC]
RewriteRule ^(.*)$ http://www.example2.com/$1 [R=301,L]

An Extra 301 Redirect To Help You Out

If you’re an .htaccess wizard, you may have noticed that I not only help you out here with the above discussed 301 redirects, but I also help redirect non-www versions of your site to the www version (via 301 redirects as well), another common SEO duplicate content issue for many sites. I sincerely hope this helps you out. It’s truly amazing that for only $6.95 per month you can now host multiple sites in an SEO-friendly manner with just a little up front work understanding and configuring your .htaccess file.

Did you find this post helpful? Looking to sign up for BlueHost or HostGator? I would sincerely appreciate it if you signed up through my BlueHost affiliate link or my HostGator affiliate link. The affiliate commissions help me maintain and expand PPC Ian! Thanks so much!

Disclaimer: Please use this code at your own risk. Your .htaccess file is a very powerful tool. Before making any changes, please back up your entire site. PPCIan.com is not liable for any problems that may arise from following these examples.

Image of Programming Matrix © iStockPhoto – Raycat

  • Darren (1)