mod_xhtml_neg home

This module for the the Apache HTTP server gives it the ability to correctly negotiate content types for XHTML documents. Without negotiation, these would be sent as text/html. For browsers that support XHTML as an XML document, the content can (and should) be sent as application/xhtml+xml. See the W3C's technical note for details.

Also see RFC 3236 for some of the technicalities of correctly negotiating XHTML documents.

One solution that's been seen around the web in a few places is to use the Apache mod_rewrite module to sniff the Accept: header in HTTP requests. This is crude but will work most of the time. See an example of this at Greytower Technologies.

This Apache module does similar negotiation, but with the following advantages:

*Profiles are XML namespaces that refer to the XHTML variants, such as XHTML Basic, XHTML Mobile Profile, and so on. The profile parameter was introduced in section 8 of RFC 3236.


The current release for Apache 1.3 is 1.0. This is a stable release. Download the source code for Apache 1.3 from the SourceForge site.

The current release for Apache 2.x is 1.0a. This is a minor bugfix release. Download the source code for Apache 2.x from the SourceForge site.



For any further information, please feel free to contact me, Nicholas Cull. Logo Last updated 2 January 2008.