October 7th, 2005


Emotionally Detached

That sums up my current state of mind/spirit/heart.  Welcome to 1997, Eugene.

Just what I need when I have to conjure a new song by the end of next week.  *sighes*

  • Current Mood

Apache Tip: IE+“application/xhtml+xml”=T_T

If your site has a bunch of .xhtml files which choke IE 'cause Apache serves 'em under application/xhtml+xml:

RewriteCond %{REQUEST_URI} !\.xhtml$
RewriteRule ^ - [skip=2]

RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml
RewriteCond %{HTTP_ACCEPT} !application/xhtml\+xml\s*;\s*q=0
RewriteRule ^ - [skip=1]

RewriteRule ^ - [type=text/html]

Basically that means: If the filename extension is .xhtml and the HTTP Accept: header either doesn't have application/xhtml+xml defined or has it defined but with quality of zero (meaning: I refuse the type), override its MIME type and return it as text/html.  This uses the fact that Mozilla/Firefox explicitly includes application/xhtml+xml in the Accept: header of each and every HTTP request while IE does not.

Note: If you have .xhtml defined in DirectoryIndex and want the above snippet to work for the directory URLs as well, it must be defined in the main httpd.conf; defining it in .htaccess does not work for an obscure reason that involves Apache's internal subquery processing.