阿帕奇的.htaccess:如何重写反斜线与斜线在Firefox? [英] Apache .htaccess: How to rewrite backslash with slash on Firefox?
问题描述
如何重写反斜线'\'
用斜线/
在Firefox?
Chrome浏览器,IE,Safari浏览器,Opera有打造的浏览器重写反斜线与斜线。
但Firefox 3.6.13回报的 404错误页面的。
#为什么火狐会返回404错误页面?
的RewriteCond%{REQUEST_URI}(。*)\\(。*)
重写规则。*%1 /%2 [R = 301,L]
这是Apache和FF的错误,的 https://issues.apache.org/bugzilla/show_bug.cgi?id=35256
希望这会固定在马上的功能。
- AllowEn codedSlashes应该真正做到上的默认情况下,甚至可能去precated。 ...
- 无处RFC文档是一个反斜杠
(\)
列为保留字符。因此,一个%5C
应永远是德codeD一样的%7E
被转换为波浪号(〜)
。
要解决它在Apache:
添加 AllowEn codedSlashes在
在虚拟主机
的httpd-vhosts.conf或httpd.conf中,和.htaccess:
RewriteEngine叙述上
的RewriteCond%{REQUEST_URI} ^(。*)\\(。*)$
重写规则。*%1 /%2 [R = 301,NC,L]
How to rewrite backslash'\'
with slash'/'
on Firefox?
Chrome, IE, Safari, Opera has build browser rewrite backslash with slash.
But Firefox 3.6.13 returns 404 error page.
# Why Firefox returns 404 error page?
RewriteCond %{REQUEST_URI} (.*)\\(.*)
RewriteRule .* %1/%2 [R=301,L]
It is Apache and FF bug, https://issues.apache.org/bugzilla/show_bug.cgi?id=35256
Hopefully it'll be fixed in soon feature.
- AllowEncodedSlashes should really be "on" by default and probably even deprecated. ...
- Nowhere the RFCs is a backslash
(\)
listed as a reserved character. Therefore a%5C
should always be decoded the same as%7E
is converted to a tilde(~)
.
To solve it on Apache:
add AllowEncodedSlashes On
in VirtualHost
httpd-vhosts.conf or httpd.conf, and .htaccess:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^(.*)\\(.*)$
RewriteRule .* %1/%2 [R=301,NC,L]
这篇关于阿帕奇的.htaccess:如何重写反斜线与斜线在Firefox?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!