问题
I'm trying to issue a redirect where the destination contains a fragment-identifier part. I tried with this rule:
RewriteRule ^/foo/bar/([^/]+)/(.*)$ /cgi/script#foobar::$1.$2 [R,L]
However the #
is converted into %23
and the web application cannot correctly parse this url. How can I force apache to keep the #
character ?
回答1:
Solution found: there is an option for not escaping urls with mod_rewrite:
https://httpd.apache.org/docs/2.2/rewrite/flags.html#flag_ne
Adding the [NE] flag solved the problem.
来源:https://stackoverflow.com/questions/9993017/apache-rewrite-rule-for-a-destination-containing-a-hash-mark