.htaccess redirect domain to subdirectory without changing URL

前端 未结 2 1836
梦毁少年i
梦毁少年i 2020-12-05 03:15

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

2条回答
  •  醉梦人生
    2020-12-05 03:39

    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.

提交回复
热议问题