I am redirecting URLs for a website, and have the following URL to match and redirect:
example.com/test-string-%2526-more-string/
However, I cannot match the %2526 portion of the string - it seems that Apache is treating the percentage symbol as a special character, and escaping it seems to make no difference. Here's the basic rule I'm trying:
RewriteRule ^test-string-\%2526-more-string/?$ /new-location.htm [R=301,L,NC]
With or without the escaping slash, this rule doesn't fire. I suspect the problem is with how apache processes encoded characters in URLs - %25 translates to a percentage symbol itself, so could Apache be 开发者_如何学Ctranslating "%25" to "%" before running the rule? Or is something else going on?
I experimented with lots of rewrite rules and in the end just went with this:
RewriteRule ^test-string-\%26-more-string/?$ /new-location.htm [R=301,L,NC]
So the %25
was converted to a %
symbol.
精彩评论