xhtml 1.1 MIME type solution

Twitter Updates


San Francisco PechaKucha Night
San Francisco IxDA


Inspired by a recent posting on diveintomark, I redoubled my efforts to make this site use XHTML 1.1 properly, even including serving it as application/xhtml+xml, which makes content unreachable by IE.

When querried, Mark said he was using Apache’s mod_rewrite module to munge the content-type field based on the UA string (mozilla), by adding this text to his .htaccess file:

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} Gecko
RewriteRule \.html$ – [T=application/xhtml+xml; charset=utf-8,PT]

I dug a little deeper, and found this technique on a German-language site. It changes the content type if the UA claims support for application/xhtml+xml.

RewriteEngine on
RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml
RewriteCond %{HTTP_ACCEPT} !application/xhtml\+xml\s*;\s*q=0
RewriteCond %{REQUEST_URI} \.html$
RewriteCond %{THE_REQUEST} HTTP/1\.1
RewriteRule .* – "[T=application/xhtml+xml; charset=utf-8]"

Author: Peter Sheerin

Peter Sheerin is best known for the decade he spent as the Technical Editor of CADENCE magazine, where he was the acknowledged expert in Computer-Aided Design hardware and software. He has a long-standing passion for improving usability of software, hardware, and everyday objects that is always interwoven in his articles. Peter is available for freelance technical writing and product reviews, and is exploring career opportunities in interaction design. His pet personal project is exploring the best ways to harmonize visual, tactile, and audible symbols for improving the effectiveness of alerting systems.

Leave a Reply