【发布时间】:2014-08-14 05:10:59
【问题描述】:
...当然除了 www,它也是一个子域。
这是我当前添加了 cmets 的 htaccess 规则:
RewriteEngine On
#redirect non-www to www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
#what does this do?
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/login/
#rewrite /a/1 to /index.php?action=a&urlId=1
RewriteRule ^([^/]+)/([^/]+)/?$ index.php?action=$1&urlId=$2 [L,QSA]
#rewrite /a to /index.php?action=a
RewriteRule ^([^/]+)/?$ index.php?action=$1 [L,QSA]
现在我的问题是,我添加了两个子域 a.domain.com 和 b.domain.com 指向同一个目录,因此通过相同的 htaccess - 但它们用于直接静态文件访问。如何防止a.example.com和b.example.com完全使用上述规则?
也许有人可以解释这是做什么的:
#what does this do?
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/login/
谢谢!
【问题讨论】: