阿帕奇的.htaccess:如何重写反斜线与斜线在Firefox? [英] Apache .htaccess: How to rewrite backslash with slash on Firefox?

查看:165
本文介绍了阿帕奇的.htaccess:如何重写反斜线与斜线在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
希望这会固定在马上的功能。

  
      
  1. AllowEn codedSlashes应该真正做到上的默认情况下,甚至可能去precated。 ...
  2.   
  3. 无处RFC文档是一个反斜杠(\)列为保留字符。因此,一个%5C
      永远是德codeD一样的%7E 被转换为波浪号(〜)
  4.   

要解决它在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.

  1. AllowEncodedSlashes should really be "on" by default and probably even deprecated. ...
  2. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆