Forum Moderators: phranque

Message Too Old, No Replies

changing root directory for two domains

         

sociolky

1:19 pm on Sep 8, 2011 (gmt 0)

10+ Year Member



assume that I've two domains:
example.com and example2.com
And i've two directory DIR_1 & DIR_2 inside the public_html folder.
Now how can I set these two directory as ROOT(an iffective .htaccess file) directory for the two domains respectively?
(More frankly,
so that "example.com/index.php" points to "public_html/DIR_1/index.php"
and "example2.com/index.php" points to "public_html/DIR_2/index.php" )
Please someone help me..:-)
Thanks in advance..:-)

phranque

5:03 am on Sep 9, 2011 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



welcome to WebmasterWorld, sociolky!

you can do this by configuring multiple virtual hosts in the server config.

Apache Virtual Host documentation:
http://httpd.apache.org/docs/2.0/vhosts/ [httpd.apache.org]

sociolky

3:29 pm on Sep 9, 2011 (gmt 0)

10+ Year Member



Thank you very much buddy.
but unfortunately I don't have access to vhost config file. My hosting provider does not provide that right. So all I can do is use a htaccess file. Can you help me out with that please. I saw some posts in WebmasterWorld. But those are for one domain only. And you saw, I said about two domain in my post.
Help me please..
Thank you :-)

phranque

1:29 am on Sep 10, 2011 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



as you saw the <VirtualHost> Directive is only effective in a server config context and no amount of .htaccess magic will get past that limitation.
you are going to need technical support from your host in order for your server to recognize requests for both hostnames.