1

I recently decided to consolidate all of my random projects into a single hosting account as it was starting to get very expensive to run each on an individual hosting plan. I purchased the HostGator Baby plan which allows hosting of multiple domains.

You have to set it up with a root domain name which is fine (I used my portfolio domain name). As far as file structure, I wanted a folder for each site in /public_html so the structure looks like this:

- public_html/
   - myportfolio.com/
      - ... my files ...
   - anothersite.com/
      - ... my files ...
   - thirdsite.com/
      - ... my files ...

I setup add-on domains and pointed them to their respective folders which works fine. My problem is the root domain ex. myportfolio.com expects it's files to be contained at the root of /public_html rather than within it's folder I created. I setup a redirect to point requests for myportfolio.com to myportfolio.com/myportfolio.com/ which works initially except (at least in my WordPress installation) it still references it's root folder as public_html.

TL;DR; What is the best way to go about setting up multiple site hosting in a shared hosting environment (i.e. I can't setup vhosts). Does anybody know of any tutorials or videos that walk through this more clearly? Thanks.

2 Answers 2

3

It's confusing and very frustrating - I had to deal with the same thing the first time I used hostgator.

This is sub-optimal, but it's the best I could come up with, working within cPanel (which I have a deep hatred for):

  1. When you create your account, specify a dummy domain name as the "primary domain" for the account. Choose anything, doesn't even need to be a domain name that exists.
  2. Then, for all your "real" domains, create them as "add-on domains".
  3. Now, your file structure will look like this.

    ~/public_html/         ←   fake domain points here
        myportfolio.com/   ←   your real domain
        domain2.com/       ←   real domain
        domain3.com/       ←   etc. etc.
    

If you've already signed up, you can talk to their support and they can change your account's primary domain, as there's no way to do that through cPanel (that I found, anyway). I looked them up via their online chat and the process was rather painless.

4
  • 1
    I figured out how to change my primary domain easy enough in the billing area of the account (gbclient.hostgator.com). I'm redoing the whole setup with my public_html containing only my primary site. Then in the root, I added a directory called sites which will contain folders for my other sites. Is this an acceptable way to go about this? Jan 30, 2012 at 3:25
  • Sure, that should work I believe.
    – EEAA
    Jan 30, 2012 at 3:28
  • Ekira, maybe creating a folder named sites under public_html may cause some conflicts in the future. Do you need to create a folder named sites ?
    – user122661
    May 28, 2012 at 18:55
  • this topic should be a sticker on Hostgator website
    – angry kiwi
    Dec 27, 2013 at 5:36
1

I've found a different solution which I am still testing out. I'm using Hostgator Business

Install wordpress for your primary domain in public_html.

Then when adding domains using the cpanel Addon Domains page, just set the domains to be in the root and not the public_html folder

To recap:

Install Wordpress for main domain in /home/yourdomain/public_html

Set Addon Domains in /home/yourdomain, this will create a folder called /home/yourdomain/addondomain

Install Wordpress in the new addondomain folder

One more note, you could just use one MySQL database for all Wordpress installations, but it seems best to keep them separate so that any issues are relegated to a single database.

Not the answer you're looking for? Browse other questions tagged or ask your own question.