: Separate multiple domains with htaccess (solution works on one hosting, not on another) I have two different domains on one VPS. It's Apache 2.4.7, I remember trying long to set up name based
I have two different domains on one VPS. It's Apache 2.4.7, I remember trying long to set up name based Virtualhosts on localhost to find out Apache Virtualhosts are not supported anymore. (I cannot find the source for that right now though)
In Apache docs for 2.4 there is a solution still with httpd.conf while httpd.conf is not used anymore.
A while ago I needed to have multiple domains on a shared hosting and I solved it with htaccess (below).
I wanted to use the solution now but on that VPS it isn't working. I have tried also other htaccess based solutions that are marked correct here but nothing works.
This particular solution below is live and well on another host though...What is wrong with it that it doesn't work on that VPS?
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?a.com$
RewriteCond %{REQUEST_URI} !^/a/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /subdirectory/
RewriteCond %{HTTP_HOST} ^(www.)?a.com$
RewriteRule ^(/)?$ /a/index.html [L]
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?b.com$
RewriteCond %{REQUEST_URI} !^/b/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /b/
RewriteCond %{HTTP_HOST} ^(www.)?b.com$
RewriteRule ^(/)?$ /b/index.html [L]
</IfModule>
Edit: AccessFilename is set correctly.
More posts by @Steve110
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.