The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Hosting multiuple add-on domains... with mod_rewrites

Discussion in 'Bind / DNS / Nameserver Issues' started by stuff10, Jul 14, 2016.

Tags:
  1. stuff10

    stuff10 Registered

    Joined:
    Jul 14, 2016
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,723
    Likes Received:
    660
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
Loading...

Share This Page