Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

[.htaccess] I wish to have my main domain in a directory, like addon domains. How ?

Discussion in 'General Discussion' started by silexian, May 22, 2006.

  1. silexian

    silexian Registered

    Joined:
    Apr 5, 2006
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    151
    Hello

    i would like to have my main domain works with the files in a subdirectory.
    Like subdomains.
    I don't know how to do that.

    Ex: http://www.domain.tld -> /public_html/foo/

    I don't want to have in the URL http://www.domain.tld/foo/ but http://www.domain.tld/
    Is this possible ?

    the reason is that i want to have a directory in /public_html for every site (main domain and addon domains).
    Otherwise, this is a mess to distinguish which directories are subdirectories for addon domains or belongs to the main domain.

    regards,
    silexian
     
  2. GnomeyNewt

    GnomeyNewt Active Member

    Joined:
    May 1, 2006
    Messages:
    28
    Likes Received:
    1
    Trophy Points:
    153
    Location:
    The Stars!
    You have two choices:

    1) To edit your httpd.conf file.

    Find the domain in httpd.conf file.
    Edit this line to where you want the domain to load its /home from:

    DocumentRoot /home/username/public_html/newdirectory

    Save and your done!


    2) Less desirable, but it will work.

    Create a .htaccess file with the following:

    Redirect / http://www.yourdomain.com/newdirectory
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. silexian

    silexian Registered

    Joined:
    Apr 5, 2006
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    151
    partially resolved

    here is a partial solution for Mambo/Joomla CMS :

    It does work for every URL but the domain (www.domain.tld & www.domain.tld/)

    Don't know why.

    Anyway, the Basis is the code below for every website (but mambo/joomla) :

     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice