views:

24

answers:

1

Hi All,

Having percent sign inside URL, returns bad request (error 400) to the browser. I have file name that have percent (%) sign, resides at server.

Original File name: 204153_20090605_Aluminiumacetotartraat_DCB_oordruppels_1,2%.pdf

Url in browser after clicking on download link:

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

This returns 400 error with bad request. I am using Kohana 3.

Please guide, how we can rectify using htaccess rule

Thanks is advance.

Existing htaccess file contents are as follows:

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] 
A: 

Try the B flag to ensure the %25, unescaped to % by mod_rewrite, is re-escaped back to %25 when inserted back into the target path.

RewriteRule .* index.php/$0 [PTB]
bobince
It returns Server error, Error 500 after adding B
Asif Mulla
You forgot the comma in `[PT,B]`.
Gumbo
Thanks @Gumbo Error disappeared, But it returned 500 error as it could not resolve %25 to %. In access log I got---127.0.0.1 - - [22/Oct/2010:18:29:42 +0530] "GET /204153_20090605_Aluminiumacetotartraat_DCB_oordruppels_1,2%25.pdf HTTP/1.1" 500 22514 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.11) Gecko/20101012 Firefox/3.6.11"
Asif Mulla