我有一个.htaccess文件,它安排所有请求都通过index.php。 现在我想对rss.php做一个例外。直接通过rss.php。 我该怎么做?

这就是现在的样子:

RewriteEngine on
RewriteBase /
RewriteRule !\.(js|ico|txt|gif|jpg|png|css)$ index.php

感谢。

有帮助吗?

解决方案

把它放在最后一行之前。

RewriteCond %{REQUEST_URI} !^/rss\.php$

其他提示

您可以使用其他 RewriteCond排除任何现有文件指令

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

或者,或者执行与文件匹配的重写,然后跳过其余的重写测试。

通过在现有的RewriteRule重定向之前放置以下行而不通过index.php。

RewriteRule  ^/rss.php  /rss.php  [L]

我在找到使用/robots.txt文件的方法时遇到了这个页面。

使用apache1.3 mod_rewrite

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top