RewriteRule,如何包含实体?
我正在尝试使用 .htaccess 中的 RewriteRule 清理博客搜索脚本的 url 清理
搜索 URL:(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。
I am tring to clean up url for my blog's search script using RewriteRule in .htaccess
Clean searching URL: (xxx= tag name ex. apple)
http://myblog.com/news/xxx/
Regular Search URL script path:
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]
This works on majority of the words except when the word has '&'.
When entered as url '&' is converted as entity '%26' but when that is entered in to the browser as http://myblog.com/news/D%26G/
my .htaccess only recognizes 'D' and skips beyond.
How do I include '%26'in my RewriteRule?
I use Movable Type 5 by the way.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用 B 标志反向引用的值被转义:
Try using the B flag to have the values of backreferences escaped: