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.

Was this answer helpful?

 Print this Article

Also Read

Activity on Ports 1028 and 135

Posted by FFCus, 01-14-2008, 12:54 AMUsing Active Ports, my Windows 2003 server is showing a very...

Image storage

Posted by Skeptical, 01-27-2011, 03:07 AMSuppose a website is running on 3 web servers, and there...

Opinion about Xen

Posted by copahost, 09-14-2008, 06:51 PMI have read many topics here about Xen vs Virtuozzo vs...

worry about hidden Hostname.how ?

Posted by mixmox, 04-19-2009, 12:49 PMhello. when i use Hostname / Reverse IP Lookup and test it...

How is this possible?

Posted by iUnknown, 09-16-2008, 02:27 PMHello, When I run the following command on my server:...