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.

link|improve this question
feedback

2 Answers

up vote 0 down vote accepted

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.

link|improve this answer
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? – cillosis Jan 30 at 3:25
Sure, that should work I believe. – ErikA Jan 30 at 3:28
feedback

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 ?

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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