Resetting to Subdomains

This post assumes some intermediate understanding of using .htaccess files, mod rewrite, and website structure.

After several months of launching my main website, I took a good hard look at my traffic and Google ranking. I soon noticed some major problems with the way the site was structured and how Google was treating my content that would only increase with time. In order to strengthen my rank, and better divide my website's content into manageable entities, I decided to utilize subdomains.

Previously, my website was divided up by simple folders, and the URLs reflected this. My waterfall site was under jacobemerick.com/waterfalls, and my blog under jacobemerick.com/blog. However, search engines still see all of this under one domain, and this started to create a very large and diverse range of content types under jacobemerick.com. My page rank was suffering simply because I had everything from web development blog posts to waterfall photo and information under a single domain. Also, as I would like to continue to diversify the services offered by my site beyond the current four sub-sites (blog, portfolio, map, and waterfalls), this problem would increase over time.

A subdomain is simply an extra word in the domain name that separates it from the main domain. Search engines see subdomains as totally separate entities with unique content. I decided to go through my current four sub-sites and make them into subdomains - instead of jacobemerick.com/blog, my blog would be blog.jacobemerick.com, etc. This way each portion of my website would be seen as a separate site with separate content types and page ranks. If my waterfall site is the most popular service, then the other sites wouldn't drag down the page ranking.

The first step was to set up the subdomains. On most web servers, this is a high-level change best done in the cPanel (or similar) backend. For me, it was a simple two-page form for each subdomain only one click off of the cPanel homepage. The main thing to avoid with this step is redirection, as its best to do this manually.

All of my websites have some sort of .htaccess with error document and rewriting information, and I wanted to avoid changing this. Since the subdomains reside in folders inside the public_html drive, I could handle all of the rewriting in the main public_html drive. So, I wanted all of my old links (jacobemerick.com/blog) to point to the subdomains (blog.jacobemerick.com)

  1. RewriteEngine on

  2. RewriteCond %{HTTP_HOST} ^(www\.)?jacobemerick\.com$

  3. RewriteRule ^$ http://home.jacobemerick.com/ [R=301,L]

  4. RewriteCond %{HTTP_HOST} ^(www\.)?jacobemerick\.com$

  5. RewriteRule ^([a-z]+)(.*) http://$1.jacobemerick.com$2 [R=301]

The important things about this redirect are the optional www in front of the URL (www.jacobemerick.com/blog is treated the same as jacobemerick.com/blog) and the L in the first rewrite rule. This flag stop the redirect rules here - as soon as the rule is processed, the following redirect rules are not processed. Also, I wanted to make sure that my longer URLs were handled correctly with the second rule. No matter what the tailing get commands or further file commands, the redirect only really affects the subdomain.

After this, it was a simple matter of changing the URLs in each site and checking on the .htaccess files. Since they mostly depending on global constants and relative links, this step was mostly painless. Now I have four separate subdomains, each with their own sitemaps and Google status, and further projects will reside comfortably separate from the rest of my site.