This question is specifically about the charset Apache (2.2 in my case) uses when serving it's default internal pages. For example, mod_autoindex directory listings, not-found ErrorDocument pages, 500-Internal Error pages, etc.

The charset Apache is currently using for these built-in pages is iso-8859-1 (see screenshot).

enter image description here

Here are my relevant Apache settings:

# apache2.conf:

AddDefaultCharset utf-8

My OS is Debian 7 and I'm using it's default prefork binary. I was thinking the charsets on these pages might not be changeable. Or maybe there is a compile-time option that affects the default charset?

And in my (Debian-specific) /etc/apache2/envvars, I sourced my default locale:

$ cat /etc/apache2/envvars
. /etc/default/locale

$ cat /etc/default/locale

$ env | grep LANG

Modifying the Content-Type header with mod_headers has no affect on Apache's default internal pages.


Yes it is possible. You can do this with a combination of ErrorDocument, <Location> and ForceType, as follows:

ErrorDocument 404 /404.html
<Location /404.html>
  ForceType "text/html; charset=utf-8"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.