【问题标题】:Rewrite url for multiple subdomains重写多个子域的 url
【发布时间】: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


【解决方案1】:

一种方法是:

RewriteCond %{HTTP_HOST} ^domain1.test.com$ [NC]
RewriteRule ^(.*)$ test1/$1 [NC,L]


RewriteCond %{HTTP_HOST} ^domain2.test.com$ [NC]
RewriteRule ^(.*)$ test2/$1 [NC,L]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-11-14
    • 2012-09-17
    • 2011-11-22
    • 2012-11-12
    • 2014-05-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多