GoDaddy Shared Hosting Multiple-Domain And Subdomain Management

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:

  1. Using GoDaddy's File Manager in their hosting tools, create the 000_other_domains/ directory.
  2. Now create a directory for each domain under 000_other_domains/, such as kennycarlile.com/, frofrolynx.com/, etc.
  3. 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.
  4. 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.
  5. 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.
  6. 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/...
  7. Once you've been able to correct all the absolute paths to point to the new one, test again.
  8. 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!

Category: 

Comments

Thanks. That was helpful. I am still a bit baffled by the whole thing but this was the closest to sensible explanation I have seen and very well organized. Part of what is still throwing me is I need to host a mix of private and public registered domains on the same plan. I am concerned that this shared directory structure will also someone to look at the code and deduce the owner of the privately registered sites by finding in the structure the publically registered sites. Especially since the existing main domain is public. Godaddy's suggestion didn't make sense to me -- they claimed I could just make up some domain that didn't exist and not register it and make it the main domain.

Hi, I like your idea of making the primary domain a dummy name and making the original primary domain another secondary domain.

However, the secondary domains are all down one level and by adding your 00_other_domains, you make them all two levels down. I don't see the value in this.

Lastly, the things that comcerns me the most is security. Does your solution (domains two levels down or one) still permit a user to access a secondary domain thru the primary domain name. (such as http://primary.com/secondary)?

thanks...
Ron...

Nice post thanks. Godaddy is great when it works but can be just so frustrating to setup. The latest mystery I am having with Godaddy is regarding subdomains where some are mysteriously redirecting to the 'root.

I use godaddy to, customer service is good I do like them, but their hosting is a messss, my problem is the creation of duplicate URL's.

I just started an unlimited w/godaddy because a client needed a 300 gigabyte ftp upload/download space.

I had an extra domain name laying around for the primary, and once I figured out that these weren't "real" domains I organized some "domains" (quoted domains) like this under the primary:

root/p/adomainname_com/httpdocs
root/p/anutherdomainname_com/httpdocs
etc.

This is your option #2. The p stands for public. I pointed the "domain" at the httpdocs sub-directory, and rooted the ftp-account for each domain just after adomainname_com (for example). This gives some semi-off-world space for data and access-control(pw/grp) files. At least from the web browser's point of view.

As I'm a total newb with GoDaddy, it was reassuring to read that you came up with essentially the same solution.

Any idea how to keep a script in any "domain" from being able to read files in all the "domains?"

Thanks for a great entry.

-s

Off the top of my head, I don't know of a solution, unfortunately. In scripts executed by the client (Javascript, etc.) couldn't see higher than the root of the domain, but server-side code (PHP, etc.) could see any directories that the execution engine has access to.

thanks for the article, interesting info. I have put a dummy domain name as main domain and each for real domain I created a subfolder. I thought about a better alternative to not getting messed up with multiple domain, there is possibility of creating a different FTP username for each domain you have, and limiting it to the subfolder you want it to have access to. That way you get a specific username for each domain!

Great article and I, too, wish I had read something like this when first setting up my Go Daddy account. About a year ago I restructured the site along the lines of Option 1 and things have gone well.

Now, though, I need Standard Wildcard SSL for one of the hosted (aka aliased) domains, not the primary/root level domain. Unfortunately, Go Daddy can only issue a certificate on primary domains. See http://support.godaddy.com/groups/go-daddy-online-security/forum/topic/r....

There are workarounds - changing the primary domain to be the one that requires SSL, or else buying a separate hosting plan - are two that come to mind.

So, SSL is just something else to consider when deciding how to structure Go Daddy multiple domain sites.

Add new comment

You can optionally provide your email address, which will remain private, if you wish to be contacted directly about this comment.

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Refresh Type the characters you see in this picture. Type the characters you see in the picture; if you can't read them, submit the form and a new image will be generated. Not case sensitive.  Switch to audio verification.