Apache rewrite rule for a destination containing a hash mark

人盡茶涼 提交于 2019-12-09 14:14:21

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!