Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Apr 2006
    Posts
    2

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

    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. #2
    Member GnomeyNewt's Avatar
    Join Date
    May 2006
    Location
    The Stars!
    Posts
    28

    Default

    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
    Sarah :c)

    cPanelDemos.com - Server safe cPanel & WHM demos.
    Can't enable cPanel demo mode? We have the solution for you!

  3. #3
    Registered User
    Join Date
    Apr 2006
    Posts
    2

    Default partially resolved

    here is a partial solution for Mambo/Joomla CMS :

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} ^/+(images|templates)$ [NC,OR]
    RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$ [NC]
    RewriteRule ^(content/|component/) joomla/index.php [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*) joomla/$1 [L]
    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) :

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*) directory/$1 [L]

Similar Threads & Tags
Similar threads

  1. Filed with Developers [Case 48382] skeleton directory for addon and sub domains
    By Tam in forum Feature Requests for cPanel/WHM
    Replies: 23
    Last Post: 09-12-2011, 06:25 AM
  2. Replies: 1
    Last Post: 01-09-2010, 02:33 AM
  3. Main Domain and Addon Domains
    By Possumnz in forum New User Questions
    Replies: 1
    Last Post: 04-28-2008, 01:10 PM
  4. Prevent .htaccess redirection from affecting addon domains
    By nerbonne in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 02-20-2008, 08:36 AM
  5. HELP! addon domain points to main domain path when browsing
    By SetLar8 in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 04-23-2006, 06:32 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube