开发者

RewriteRule, how do I include entities?

开发者 https://www.devze.com 2023-01-23 09:42 出处:网络
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)

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&开发者_JAVA百科;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.


Try using the B flag to have the values of backreferences escaped:

RewriteRule ^([^/]*)/$ /scripts/search.cgi?blog_id=4&tag=$1&limit=10 [L,B]
0

精彩评论

暂无评论...
验证码 换一张
取 消