Solution to the Apache Content-Type nightmare

Apache No Comments »

I’ve found a solution that I deem acceptable for the Apache Content-Type nightmare I described earlier. Since .htaccess files apply not only to their own directories but to all subdirectories as well, I added the following stanza to my .htaccess file to force all types for files ending in HTML to UTF-8:

# .htaccess

AddCharset UTF-8 .html

I also have used a trick from here which describes how to serve up the MIME type application/xhtml+xml, the recommended (and eventually required) MIME type for XHTML pages, to browsers that can support it. Namely:

# .htaccess continued
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_ACCEPT} application/xhtml+xml
RewriteCond %{HTTP_ACCEPT} !application/xhtml+xmls*;s*q=0
RewriteCond %{REQUEST_URI} .html$
RewriteCond %{THE_REQUEST} HTTP/1.1
RewriteRule .* - [T=application/xhtml+xml]
WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in