Hosting multiuple add-on domains... with mod_rewrites

stuff10

Registered
Jul 14, 2016
1
0
1
England
cPanel Access Level
Root Administrator
Hi,

First post here, so please be gentle.

I have a VPS with WHM and cPanel, with root access.

One of my websites, example.com allows users to create their own websites, eg:

example.com/site1
example.com/site2
example.com/site3
etc

I would like the users to be able to use their own domain for this, so:

site1.com shows example.com/site1
site1.com/page1 shows example.com/site1/page1
site1.com/page2 shows example.com/site1/page2

site2.com shows example.com/site2
site2.com/page1 shows example.com/site2/page1
site2.com/page2 shows example.com/site2/page2
etc

I understand that I can do this by adding add-on domains, however...

The sites are using htaccess mod_rewrite to generate the URLs. So /http_docs/site1/ doesn't exist as a folder, the actual path to the website files would be example.com/files/index.php?site=1

How can I set the server up so that:

site1.com shows example.com/site1
site2.com shows example.com/site2
Etc

I'm a novice when it comes to WHM and cPanel, so any help would be greatly appreciated.

Many thanks,

Rob
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,224
463
Hello,

You can use the "Manage Redirection" option in "cPanel >> Addon Domains" after creating the new addon domain. This will let you redirect the addon domain name to the URL of your preference. Or, if I understand correctly, the Mod_Rewrite rules are automatically generated, so you would simply configure the document root for each addon domain name to the directory where the .htaccess file with these rules is stored.

Thank you.