我想在.htaccess中使用RewriteRule为我的博客搜索脚本清理网址
清理搜索网址:(xxx =标记名称,例如苹果)
http://myblog.com/news/xxx/
常规搜索URL脚本路径:
http://myblog.com/scripts/search.cgi?blog_id=4&tag=xxx&limit=10 [L]
的.htaccess
RewriteRule ^([^/]*)/$ /scripts/search.cgi?blog_id=4&tag=$1&limit=10 [L]
这适用于大多数单词,除非单词有'&'。
输入为url'&'时被转换为实体'%26',但当它作为http://myblog.com/news/D%26G/
输入浏览器时,我的.htaccess只识别'D'并跳过。
如何在我的RewriteRule中包含'%26'?
顺便说一句,我使用Movable Type 5。
答案 0 :(得分:1)
尝试使用B flag让反向引用值转义:
RewriteRule ^([^/]*)/$ /scripts/search.cgi?blog_id=4&tag=$1&limit=10 [L,B]