【发布时间】:2010-11-06 16:52:04
【问题描述】:
我正在尝试使用 .htaccess 中的 RewriteRule 为我的博客搜索脚本清理 url
干净的搜索 URL:(xxx= 标记名称 ex.apple)
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。
【问题讨论】:
标签: regex .htaccess mod-rewrite movabletype