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

2023-09-02 00:33:38 作者:生无可恋°

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

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

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

  www.example.com/folder/folder/thumbs%5C1.jpg
 
蛇从暗黑中袭来 响尾蛇 SideWinder APT组织2020年上半年活动总结报告

我使用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.com/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]