Multiple Drupal Sites on One GoDaddy Economy Hosting Account

Have you ever been lured by cheapness of GoDaddy Economy Hosting to host your Drupal websites? Did you then find out that they allow multiple domains but all of these domains need to point to one website, i.e one code base in the root folder? I have. But here's a neat little trick to have a different code base for each site.

Create a .htaccess file in the root folder and paste the following code:

RewriteEngine on
 
# Remove "www" from all requests.
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [L,R=301]
 
# Serve Drupal from a subfolder
RewriteRule ^$ %{HTTP_HOST}/index.php [L]
RewriteCond %{DOCUMENT_ROOT}/%{HTTP_HOST}%{REQUEST_URI} -f
RewriteRule .* %{HTTP_HOST}/$0 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* %{HTTP_HOST}/index.php?q=$0 [QSA]

Now for each hosted domain, the code will go into a folder named after the domain. Examples:

  • The code for example.com would go into a folder called example.com
  • The code for sandogeorge.me would go into a folder called sandogeorge.me

And there you have it. No need to compromise on your cheap spending habits!

__________________

Sando George Sando George is a web development freelancer and a budding Computer Science researcher. He also serves as the CTO of Social Capital Holdings, a startup company dedicated to raising funds for charitable and socially responsible organizations.