从工作重写规则中排除admin.php

时间:2012-04-25 14:41:26

标签: apache .htaccess mod-rewrite url-rewriting

我的.htaccess文件中有一个工作重写规则,它应该从以/结尾的页面重定向到没有它们。

所以举个例子 http://mysite.com/gallery/ 会重定向到 的 http://mysite.com/gallery

重写规则如下所示:

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^(.+)/$
RewriteRule ^(.+)/$  /$1 [R=301,L]

并且工作率为99%。我遇到的唯一问题是我需要将其排除在

之外

http://mysite.com/admin.php/whatever_may_follow

我不是这些规则的专家,并且希望有人能指出如何从规则中排除admin.php。

提前致谢! ;)

1 个答案:

答案 0 :(得分:1)

RewriteCond %{REQUEST_FILENAME} !admin.php$