.htaccess - htaccess 从 URL 转义百分比 (%)

标签 .htaccess kohana-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] 

最佳答案

试试 B flag确保%25 ,未转义到 %通过 mod_rewrite,重新转义回 %25当插入回目标路径时。

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

关于.htaccess - htaccess 从 URL 转义百分比 (%),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3996726/

相关文章:

sql - 如何在 Kohana 3 中配置 SQLite?

regex - 301 将 pdf 文件重定向到我的新网站

apache - 将 RewriteCond 与 %{REQUEST_URI} 一起用于 mod_rewrite

.htaccess - 使用参数重定向网站的某些部分

apache - 在 URL RewriteRule 中转义 # char

php - 使用 Kohana 3,我如何从数据库类中获取最后一个插入 ID?

mysql - 如何在调用一种模型方法期间更改 Kohana 框架内的 mysql 分隔符?

regex - 在 .htaccess 中禁用 HTTP 跟踪

php - Kohana 3分页

php - Kohana 与 AJAX 获取请求