【发布时间】:2011-06-10 14:34:42
【问题描述】:
我遇到了mod_rewrite 的问题,我想在其中匹配并替换特定的 URL。我要重写的网址是:
http://example.com/rss 到 http://example.com/rss.php
这意味着,如果有人在rss 之后附加任何内容,则会发送 404 Not Found 响应。目前我正在使用这个mod_rewritesn-p:
Options -Indexes
RewriteEngine on
RewriteBase /
# pick up request for RSS feed
RewriteRule ^rss/?$ rss.php [L,NC]
# pass any other request through CMS
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+) index.php/$1
但这匹配 rss 和 rss 以及添加到末尾的任何其他内容。我怎样才能重写以上内容以访问 only http://example.com/rss 作为 mod_rewrite 匹配的模式?
【问题讨论】:
标签: .htaccess mod-rewrite