How to stop apache from doing url decoding?

Posted by mrzippy, 04-20-2009, 03:12 PM
Hello, I have an interesting problem.. there is a customer who transferred their site over to our servers and has run into some kind of encoding issue. They have file on their website named: EXCL%204810_00%20BeefSkewers.jpg You can see that the "%20" characters are actually part of the file name on the server. So the problem is that when they try to call the image in a URL: http://www.domain.com/rimages/EXCL%204810_00%20BeefSkewers.jpg It gives a 404 not found error. We use apache 2.2.x on our servers, and my admins are stuck on how to fix this. Any suggestions? (Besides renaming the files. The problem is that this issue appears to also effect other text in their database that uses various symbols, such as the ", ', and the degree (for temperature) sign...) Thanks. Last edited by mrzippy; 04-20-2009 at 03:15 PM.

Posted by ramnet, 04-20-2009, 08:46 PM
There is no way to fix this because the encoding is done to satisfy the RFC papers that dictate that a URI cannot contain particular characters (such as space, ?, etc) In your specific case, what you should do is decode the file name itself and that would fix everything. In your case you would replace %20 with a space. Then if you refer to the file using %20 or not it will work. Basically rename "EXCL%204810_00%20BeefSkewers.jpg" to "EXCL 4810_00 BeefSkewers.jpg" on the file system side.

Posted by hiabhilash, 04-21-2009, 02:59 AM
mrzippy, try using "AllowEncodedSlashes" directive. Good luck!

Posted by dexxtreme, 04-21-2009, 04:43 PM
The best solution would be to not have filenames that use characters that have "special" meanings, such as commas, apostrophes, percent signs, ampersands, slashes, plus signs, etc. Filenames should really be limited to alphanumerics, dashes, underscores, periods, and maybe a couple other characters. (Even spaces can cause issues, namely being remapped into %20 entries.) That would be the only way to guarantee that all OS'es, scripts, and filesystems have little to no problems managing the files.

?האם התשובה שקיבלתם הייתה מועילה

 הדפסת המאמר

קראו גם

permissions

Posted by shakybaky, 06-26-2008, 04:24 AMI have a vps running centos5 WHM/cpanel I recently...

New PHP Exploit

Posted by jon-f, 09-11-2007, 06:27 PMcheck this out...

How to remove Nobody Check Security

Posted by amirasap, 02-13-2011, 05:16 PMHi i want to install new version of "Nobody Check...

php/mysql q

Posted by Sammy89, 02-14-2011, 03:45 PMis there a better way to write: Posted by...

Compromised???

Posted by Chinese Democracy, 04-20-2009, 12:01 PMIt appears that one new sign-up on a shared...