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.

[.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:
    1
    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:
    1
    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
     
  3. silexian

    silexian Registered

    Joined:
    Apr 5, 2006
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    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