Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache ';%2';按规定脱光衣服_Apache_.htaccess_Mod Rewrite - Fatal编程技术网

Apache ';%2';按规定脱光衣服

Apache ';%2';按规定脱光衣服,apache,.htaccess,mod-rewrite,Apache,.htaccess,Mod Rewrite,我对.htaccess有如下规则: RewriteCond %{REQUEST_URI} ^/services/service1/?$ RewriteRule . http://www.domain.com/Service1%20Services.html [R=301,L] 但是%2正在剥离,最终结果是http://www.domain.com/Service10Services.html 我已经搜索并发现%2,就像%1是一个 我的问题是,我不知道如何将其转义,以便将其视为字符串文字。有人能

我对.htaccess有如下规则:

RewriteCond %{REQUEST_URI} ^/services/service1/?$
RewriteRule . http://www.domain.com/Service1%20Services.html [R=301,L]
但是
%2
正在剥离,最终结果是
http://www.domain.com/Service10Services.html

我已经搜索并发现%2,就像%1是一个


我的问题是,我不知道如何将其转义,以便将其视为字符串文字。有人能告诉我该怎么做吗?

%2
是一个特殊的反向引用变量,您需要对其进行转义才能真正使用它。对于非编码,您还需要
NE
标志

使用此规则:

RewriteRule ^services/service1/?$ http://www.example.com/Service1\%20Services.html [R=301,L,NE]

愚蠢的建议1:反斜杠?愚蠢的建议#2:百分之二?两个都试过了。。不工作^Internal Server Error(500)如果我使用了网元,如果我没有使用网元,则会导致
http://www.domain.com/Service1%2520Services.html
。很抱歉上面的最后一句话,这是不正确的,因为缓存。使用NE会使错误日志显示“/public\u html/.htaccess:RewriteRule:bad flag delimiters”,带有
NE
标志,我得到的最终URI为
/Service1%20Services.html
但没有
NE
我得到的是
/Service1%2520Services.html
,所以这里确实需要
NE
。你的Apache版本是什么?这很奇怪,它应该可以工作。你有没有在NE前多留点空间?天哪,这很重要。它现在可以在没有额外空间的情况下工作。谢谢