Apache rewrite rule for a destination containing a hash mark
-
28-05-2021 - |
Pergunta
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 ?
Solução
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.
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow