I have the following setup: -> domain1.com is my main domain and also document root -> domain2.com is another domain which is registered as an alias domain (means it does ex
Below code works perfectly for me.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteCond %{REQUEST_URI} !^/folder_name/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /folder_name/$1
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(/)?$ folder_name/index.html [L]
You can use this rule:
RewriteCond %{HTTP_HOST} ^(www\.)?domain2\.com$ [NC]
RewriteRule !^subdir/ /subdir%{REQUEST_URI} [L,NC]
This will prefix every request for domain2.com
with /subdir
if it is not already there.