Apache包含哈希标记的目标的重写规则 [英] Apache rewrite rule for a destination containing a hash mark
本文介绍了Apache包含哈希标记的目标的重写规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试发出重定向,其中目标包含片段标识符部分. 我尝试了以下规则:
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]
但是#
会转换为%23
,并且Web应用程序无法正确解析此URL.如何强制apache保留#
字符?
However the #
is converted into %23
and the web application cannot correctly parse this url. How can I force apache to keep the #
character ?
推荐答案
找到了解决方案:有一个选项可以不使用mod_rewrite来转义url:
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
添加[NE]标志可以解决此问题.
Adding the [NE] flag solved the problem.
这篇关于Apache包含哈希标记的目标的重写规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文