• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

Multiple domains on one IP

Elite Diviner
Joined
Aug 15, 2008
Messages
489
Reaction score
43
I don't really know where this belongs, but I assume this can be done with .htaccess so it's atleast somehow related to coding.

Basically, I've got 2 domains. My primary domain points to /www/html/ folder where are all the files for that website.
Now, I want to have my second domain to take to a different folder inside the /www/html/, this domain would be called "second".

What I tried was I created a .htaccess file in the /www/html/ and added this.
Code:
RewriteEngine On
Options +FollowSymlinks
RewriteBase /

RewriteCond %{HTTP_HOST} ^(www\.)?mydomain\.com
RewriteCond %{REQUEST_URI} !second/
RewriteRule ^(.*)$ second/$1 [L]
Which should redirect the second domain into a folder "second".
Whenever I enter my second domain, it takes me to exactly the same place as the primary one despite of the .htaccess being there.

I've been trying to google this but with no results. I found out about the .htaccess thing through google, but that didn't help me at all.
 
Back
Top