我目前有一个.htaccess重写规则,它会将包含/ws
的所有网址重定向到/ws/index.php
,例如。 www.domain.com/ws/controller/function
RewriteEngine on
RewriteBase /ws/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1 [L,QSA]
我希望为包含/ email /的所有请求添加另一个重定向,因此www.domain.com/email/controller/function将重定向到/email/index.php。< / p>
我的完整.htaccess看起来像下面的代码,但似乎/ email /永远不会被调用。
RewriteEngine on
RewriteBase /ws/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1 [L,QSA]
RewriteEngine on
RewriteBase /email/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1 [L,QSA]
我已尝试将^ /电子邮件添加到RewriteRule
有条件但无效。
任何帮助都将不胜感激。
由于
答案 0 :(得分:1)
您可以使用:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
RewriteRule ^ws/(.*)$ ws/index.php?url=$1 [NC,L,QSA]
RewriteRule ^email/(.*)$ email/index.php?url=$1 [NC,L,QSA]