cPanel Addon Domains and Mod_Rewrite

Discussion in 'General' started by Big Dan, Dec 6, 2010.

  1. Big Dan

    Big Dan EQ Forum Moderator Staff Member

    Joined:
    Aug 14, 2008
    Messages:
    647
    Likes Received:
    16
    By default when you create an addon domain in cPanel it places the sites files under /home/user/public_html/domain.com.

    cpanel-add-domain-default.JPG

    This isn't a problem when your serving static sites. However /home/user/public_html is the path for serving the primary domain. If you're running something like Wordpress with 'pretty permalinks' on the primary domain mod_rewrite in the parent directory (public_html) messes with subfolders (your secondary domain) and results in errors. Most common is you will see the secondary domain's URLs rewritten to primarydomain.com/secondarydomain.com/path/to/file.html which results in a 500 internal server error.

    The easiest fix is to define the addon domain's path as /home/user/domain.com. This is easily done via the addon domains screen, simply remove public_html/ from the path.

    cpanel-add-domain-fixed.JPG

    I wrestled with this quite a bit in my early days of multi-siting on one cPanel account. Even going so far as to buy a domain to use as nothing more than my primary domain (a place holder). At the time none of the hosts seemed to know what was going on. Later on as a played more and more with Apache I figured out the problem on my own and have been using the /home/domain.com solution with no issues for quite a while.

    I hope this explanation and tutorial saves someone all the frustration I had. :hammer:
     


    Last edited: May 3, 2011
  2. jadae

    jadae New Email

    Joined:
    Sep 26, 2011
    Messages:
    1
    Likes Received:
    0
    This seems to work only with static .html pages.
    I had 2 addon domains and i did the same with both the sites.
    The result was interesting.
    One domain worked fine since it had "index.html". the other domain having "index.php" still showed Internal Server error.
    Seems the problem lies in running scripts.
    Any ideas on how to solve this one :hammer:
     

  3. Big Dan

    Big Dan EQ Forum Moderator Staff Member

    Joined:
    Aug 14, 2008
    Messages:
    647
    Likes Received:
    16
    Hey sorry I missed this post. Are you still having trouble? Hopefully you have sorted it out by now.
     

Want to reply or ask your own question?

It only takes a minute to sign up (and it's free!). Click the orange sign up button to choose a username and then you can ask your own questions on the forum.
Loading...