cPanel Addon Domains and Mod_Rewrite

Big Dan

EQ Forum Moderator
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:

jadae

New Email
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:
 

Big Dan

EQ Forum Moderator
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:

Hey sorry I missed this post. Are you still having trouble? Hopefully you have sorted it out by now.
 
Top