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

ebraden

Registered
Jan 8, 2013
1
0
1
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?
 

cPanelMichael

Technical Support Community Manager
Staff member
Apr 11, 2011
47,911
2,234
363
cPanel Access Level
DataCenter Provider
Twitter
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:

/usr/local/apache/htdocs/ptwebsiteengine/

It will be:

/home/username/public_html/ptwebsiteengine/

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.