- From: Dominique Hazaël-Massieux <dominique.hazael-massieux@centraliens.net>
- Date: 04 Dec 2002 13:27:50 +0100
- To: www-archive@w3.org
- Message-Id: <1039004871.23384.474.camel@stratustier>
XHTML is a great way forward to avoid the infamous tag soup that many web sites have deployed over the time. But for this, and as described by http://www.w3.org/TR/xhtml-media-types/#application-xhtml-xml it ought to be served as application/xhtml+xml. But some browsers do not recognize this mime-type, and for instance, IE proposes to download a page served with this mime-type instead of displaying it. Here is a solution to workaround this. On my personal web site, I serve my XHTML 1.0 as application/xhtml+xml for all user agents, except those that don't have this mime-type in their Accept header AND have text/html or */* in it. For those, it is served as text/html (which is OK, since my XHTML follows the compatibility guidelines). To do that, I use the following settings on Apache (very much inspired from http://schneegans.de/tips/apache-xhtml.html): # All my .html files are XHTML AddType application/xhtml+xml html RewriteEngine On RewriteBase / RewriteCond %{HTTP_ACCEPT} !application/xhtml\+xml RewriteCond %{HTTP_ACCEPT} (text/html|\*/\*) RewriteCond %{REQUEST_FILENAME} .*\.html RewriteRule ^.*$ - "[T=text/html,L]" (compared to the original version, it makes the right mime-type the default, and the wrong one only in some very specific cases). Among the browsers that do not recognize application/xhtml+xml, I have tested with Netscape 4.7 on Linux and IE5.5 on Windows, and they both displayed the pages correctly (e.g., they didn't ask to download the page). -- Dominique Hazaël-Massieux - http://www.nimbustier.net/
Received on Wednesday, 4 December 2002 07:28:36 UTC