首页 文章

htaccess从URL中转义百分比(%)

提问于
浏览
3

在URL内部进行百分号签名,将错误请求(错误400)返回给浏览器 . 我有一个文件名,其百分比(%)符号位于服务器上 .

原文件名:204153_20090605_Aluminiumacetotartraat_DCB_oordruppels_1,2%.pdf

点击下载链接后在浏览器中显示网址:

http://www.example.com/204153_20090605_Aluminiumacetotartraat_DCB_oordruppels_1%2C2%25.pdf

这会在错误请求时返回400错误 . 我正在使用Kohana 3 .

现有的.htaccess文件内容如下:

RewriteEngine On

RewriteBase /

<Files .*>
Order Deny,Allow
Deny From All
</Files>

RewriteRule ^(?:application|modules|system)\b.* index.php/$0 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule .* index.php/$0 [PT]

1 回答

  • 1

    尝试B flag以确保 %25 (通过mod_rewrite转义为 % )在插回目标路径时重新转发回 %25 .

    RewriteRule .* index.php/$0 [PTB]
    

相关问题