[lug] Serving XHTML as text/html

Matt Thompson thompsma at jilau1.colorado.edu
Mon Oct 30 15:19:41 MST 2006


I have an Apache question for the list that I'm sure is easy to do.

Namely, my personal webpage is XHTML and is served as 
application/xhtml+xml and for most modern browsers, that is fine.  Of 
course, IE6 (dillo, lynx...) borks on that, but I never really cared nor 
had the ability to do anything about that (the page below is served on 
an external server).

But, now I am setting up a web server that I have direct control over, 
so I thought I could fix it.  Plus, the fact that IE7 doesn't do XHTML 
either makes me think it's time.

What I'd like to do is have a way to send my XHTML pages as text/html to 
those browsers that can't do app/xhtml.  Most solutions I've seen use 
the HTTP_ACCEPT header (cool), but are in PHP or CGI.  I'd rather not 
rely on adding a ?php to each page or anything like that.

So, I was wondering if there was an easy way to do it in httpd.conf. 
I'm sure there is, and I've seen quite a few possibles on the interweb 
using mod_rewrite or mod_negotiate.  But I'm not enough of an Apache 
user to know if I'd be doing bad things using a config from a 2003 blog 
post that was safe then, but double-plus-ungood now.  (Or if the modules 
on those pages still exist...)

Thanks for any help,
Matt
-- 
The mayfly lives only one day, and sometimes it rains. - Geo. Carlin
    Matt Thompson -- http://ucsub.colorado.edu/~thompsma/
    440 UCB, Boulder, CO  80309-0440
    JILA A510, 303-492-4662



More information about the LUG mailing list