RewriteRule, how do I include entities?
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]
精彩评论