【发布时间】:2018-12-12 04:55:21
【问题描述】:
我想为 .htaccess 中的两个子域重写 url
domain1.test.com -> domain1.test.com/test1
domain2.test.com -> domain2.test.com/test2.
实现它的正确方法是什么?
【问题讨论】:
标签: php apache .htaccess mod-rewrite
我想为 .htaccess 中的两个子域重写 url
domain1.test.com -> domain1.test.com/test1
domain2.test.com -> domain2.test.com/test2.
实现它的正确方法是什么?
【问题讨论】:
标签: php apache .htaccess mod-rewrite
一种方法是:
RewriteCond %{HTTP_HOST} ^domain1.test.com$ [NC]
RewriteRule ^(.*)$ test1/$1 [NC,L]
RewriteCond %{HTTP_HOST} ^domain2.test.com$ [NC]
RewriteRule ^(.*)$ test2/$1 [NC,L]
【讨论】: