jon
jon

Reputation: 73

Apache gives 404 for encoded urls with special characters

I have an application that generates xml files, and they might contain special characters. My problem is that Apache will not give me the xml file if the url with the special character is encoded.

Example: File ABCö.xml is accessible by http://host/path/ABCö.xml, but if accessed with encoded url http://host/path/ABC%F6.xml apache gives me an 404.

Is this a setting in httpd.conf or do I need som rewriting to make the xml files accessible by both urls?

Upvotes: 1

Views: 2214

Answers (1)

Pekka
Pekka

Reputation: 449435

You may have an encoding issue.

Most (all?) modern browsers use UTF-8 when encoding special characters in URLs that the user inputs directly into the address bar.

So when you enter ABCö.xml say in Firefox, it will transform ö into its UTF-8 multi-byte representation, so the end result will be

ABC%C3%B6.xml

and not the single-byte

ABC%F6.xml

only one of them will work. Check which encoding is used in your file name.

Upvotes: 3

Related Questions