If you use GoDaddy’s shared hosting plans that support multiple domains (the Deluxe or Unlimited plans) and you’ve tried to manage multiple domains and subdomains, then you probably are already familiar with the organizational frustrations that can occur.
In a standard web server environment, each domain and subdomain has it’s own directory, usually under a hosting directory, like this:
~/
myprimarydomain.com/
www/
index.html
...
somesubdomain/
index.html
...
myotherdomain.net/
www/
index.html
...
someothersubdomain/
index.html
...
Unfortunately, with the Godaddy shared hosting plans, some domain must be the primary domain and it must live in the root. That is, you’ll end up with a directory structure like this.
~/
footer.php
header.php
index.php
images/
...
javascript/
...
myotherdomain.net/
index.php
...
picturessubdomainforprimarydomain/
index.php
...
someotherdomain.org/
index.php
...
...
As you can see, this gets pretty muddy when you have the code for a website for your primary domain mixed in with your other domains and subdomains. Unfortunately, there’s no way to completely fix this issue with the inexpensive hosting plans. However, you do have a few options to organize your hosting directory.
Option 1 - The “Primary Domain Gets Screwed” Solution
You can setup a domain that you don’t care about for the primary hosted domain. Then, just don’t put anything in the root and start organizing your domains in folders with subdomains in those folders. With that method, you have to buy an extra domain that you aren’t going to use.
Another way you can do this is with a root-level redirect. You can put a single redirect in the root to point the primary domain to its properly nested directory. The problem with this is that you are going to get a long junky URL (after redirect, http://www.mydomain.com/managed_domains/mydomain.com/www/index.php
) for the primary domain unless you can get mod_rewrite
to work with GoDaddy. I haven’t tried this, but I suspect you won’t be able to rewrite the URLs in a pretty manner as you aren’t allowed access to the Apache httpd.conf
file.
Option 2 - The “Try To Keep The www Subdomain Content For Your Primary Domain Well-Organized/Minimal And Manage All Your Other Domains And Subdomains Correctly” Solution
Okay, maybe that solution needs a better name. :)
This is the solution I’m currently using. My kennycarlile.com is my primary hosted domain, so I have to keep my www content in the root. I wanted to organize my other domains (and subdomains for kennycarlile.com), so I put my www.kennycarlile.com content in the root and then created a folder for other domains called 000_other_domains
. I chose this name, with leading 0’s because that will force it to always (well, in theory) put that directory first in an alphabetical listing of the parent directory.
Within ~/000_other_domains/
, I then create a folder for each domain, independent of the subdomain. That is, I have ~/000_other_domains/kennycarlile.com/
as a parent folder for all my other subdomains. For this case where this is for the primary domain, the www
directory exists at the root (~/
), but all other domains exist in this directory:
~/
000_other_domains/
528digital.com/
www/
frofrolynx.com/
www/
kennycarlile.com/
demo/
wiki/
[www/ does not exist here because this is the
primary domain and it must exist at ~/]
kennycarlile.net/
gallery/
www/
moonfar.com/
www/
nwdirtriders.com/
forum/
gallery/
www/
...
While you still end up with your primary domain’s www directory mixed in the root with the 000_other_domains/
directory, you have the rest of your domain and subdomain structure organized logically.
Option 3 - The “You’re Actually Making Money From Your Site So You Can Afford Some Real Hosting” Solution
If you’re making money off your site and it’s not just a hobby, you can probably splurge for the $35+/month virtual dedicated hosting that allows you to have a lot more control over your Apache configuration. This isn’t a really a solution since the issue is trying to fix the shared hosting problem, but I just wanted to point out this option.
Fixing A Poorly Planned Hosting Setup
I hope that helps someone out there. I would have liked to have seen this kind of write up prior to starting to manage my hosting. As it was, I had all of my domains and subdomains in folders at the root (~/
) of my hosting directory. To clean this up, I had to move many of my installs. I was worried about breaking/corrupting my applications that GoDaddy had installed for me (WordPress, PHPbb, Twiki, etc.), so on the advice of one of their very helpful and articulate tech support reps, I followed these steps:
- Using GoDaddy’s File Manager in their hosting tools, create the
000_other_domains/
directory. - Now create a directory for each domain under
000_other_domains/
, such as kennycarlile.com/, frofrolynx.com/, etc. - Using the File Manager tool, COPY the improperly placed folder where your subdomain (that includes the implicit ones like www, except for your primary domain, which has to stay at
~/
) and rename the copied folder as appropriate. You should now have a directory structure like~/000_other_domains/frofrolynx.com/www/
where a copy of your frofroynx.com content resides. - In domain management, modify the record for each domain and subdomain (do subdomains first so you can go back and mange the parent domain while you are waiting for the subdomains to take effect, which happens every 30 minutes), so that it points to the NEW location:
~/000_other_domains/frofrolynx.com/www/
. Again, this will take ~30 minutes to take effect. - Rename your OLD directory to something like
xxx_[foldername]
so that you know 100% that you aren’t accidentally seeing the old install because the domain change hadn’t yet taken effect. This also helps you identify which folders you need to delete later. - Now test your install. For some applications or plugins for applications, you may have to edit config files to point to the new server path, such as changing
/home/content/u/s/e/username/html/old_domain_directory/...
to/home/content/u/s/e/username/html/000_other_domains/frofrolynx.com/www/...
- Once you’ve been able to correct all the absolute paths to point to the new one, test again.
- After a day or two, if you feel confident that everything is working as is, you can delete your
xxx_[foldername]
.
Well, that about covers my experience with trying to fix a poorly-managed (by me) hosting account on GoDaddy’s shared hosting. Hopefully that will safe someone else some pain and hassle by learning from my mistakes and experience. Good luck!