开发者

Using .htaccess to replace backslash in URL with forward-slash

开发者 https://www.devze.com 2023-01-03 21:33 出处:网络
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 ha

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 r开发者_如何学Cewrite all \ to /?


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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号