使用的.htaccess用斜杠代替反斜杠网址

编程入门 行业动态 更新时间:2024-10-23 21:37:50
本文介绍了使用的.htaccess用斜杠代替反斜杠网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我意识到反斜杠不应出现在在不是URL逃逸code以外的形式的URL,但是在这种情况下,URL被正由用于产生flashbooks .NET应用程序生成的。我所接触的这个应用程序的开发人员的bug报告。

在此期间我想使用的.htaccess重写有问题的反斜杠。

这是网址怎么会出现在小提琴手调试代理。

www.example/folder/folder/thumbs%5C1.jpg

我使用Firefox和它看起来好像火狐被翻译成的URL连接codeD当量(\ ==%5C1)。有趣的是IE浏览器自动转换反斜线成正斜杠(不遵守标准,但方便的在这种情况下)。

有没有办法使用的.htaccess重写所有\到/?

解决方案

RewriteEngine叙述上 的RewriteCond%{REQUEST_URI}(。*)\\(。*) 重写规则。*%1 /%2 [R = 301]

I realise that a backslash should never appear in a URL in a form other than a URL escape code, however in this case the URL's are being generated by a .NET application for generating flashbooks. I have contacted the developer of this application with a bug report.

In the interim i would like to use .htaccess to rewrite the offending backslashes.

This is how the URLs appear in fiddler debugging proxy.

www.example/folder/folder/thumbs%5C1.jpg

I am using Firefox and it looks as though Firefox is translating them into the URL encoded equivalent ( \ == %5C1 ). Interestingly IE translates the backslash into a forward-slash automatically (not adhering to standards but convenient in this case).

Is there a way to use .htaccess to rewrite all \ to /?

解决方案

RewriteEngine On RewriteCond %{REQUEST_URI} (.*)\\(.*) RewriteRule .* %1/%2 [R=301]

更多推荐

使用的.htaccess用斜杠代替反斜杠网址

本文发布于:2023-11-01 20:25:48,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1550324.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:斜杠   网址   htaccess

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!