Migrating several websites with same web root using mod-rewrite...


Jan 8, 2013
cPanel Access Level
Root Administrator
We are currently on a generic (no cPanel, Plesk, etc) LAMP server running Redhat and on this system that we are migrating onto cPAnel from, we have a single php code base with one database that supports about 15 different domains.

All these 15 domains are pointing to the same webroot e.g., /usr/local/apache/htdocs/ptwebsiteengine/ and we are using apache's mod-rewrite to send each domain to the appropriate index.php file e.g, RewriteRule ^/$ /websites/30/index.php

I am having trouble figuring out how to implement this scheme in the WHM/cPanel environment and have actually started looking at implementing this outside of the WHM/cPanel environment by setting up the webroot in /usr/local/apache/htdocs/websites/ptwebsiteengine and working with apache include files to tell apache about it.

Can I do this in the WMH/cPanel environment or must I create this scheme outside of WHM/cPanel?


Staff member
Apr 11, 2011
Hello :)

I recommend reassessing the current structure you have in place for your domain names. Do you want all of the domain names under the same account? If so, you can create a cPanel account, and add these domain names as "Addon" domains. In addition, you should update your scripts and mod_rewrite rules to reflect the paths that will be used on the cPanel server. So, instead of:


It will be:


Updating your scripts and rewrite rules will be much easier than trying to implement a custom solution to workaround the standard cPanel configuration.

Thank you.