This module is contained in the
file. It provides content negotiation facilities for XHTML
This module provides content negotiation facilities for XHTML documents that conform to Appendix C compatibility requirements of the XHTML 1.0 specification. This allows compatible browsers to view XHTML content as XML-compliant documents, and older or less compatible clients to view XHTML content as text/html documents.
This directive enables or disables content negotiation
for the document realm in question.
(That is, if found in an
.htaccess file, for
instance, it applies only to documents generated from that
directory.) If set to
negotiation will be performed for any document
in the realm (unless overridden at a lower level, such as an
.htaccess file overriding a server config file).
If set to
On, the header will be added to
served documents according to the criteria defined by the XhtmlNegTypes and XhtmlNegStarsIgnore directives.
Note that this directive does not guarantee that content negotiation will be performed. If the criteria aren't met, no negotiation will be performed, and the effect will be as though this directive wasn't even specified.
XhtmlNegLog directive defines the path
and filename of an optional log file. Status messages regarding
success or failure to negotiate are sent to this log file. If
this directive is not specified, no logging takes place.
XhtmlNegTypes directive defines the
content-negotiation for a given file extension. Each token contains
a content-type, followed by optional charset value, relative quality,
and profile information.
XhtmlNegTypes .html application/xhtml+xml;charset=iso-8859-1 \ application/xml;q=0.5 text/html;charset=iso-8859-1;q=0.8 \ text/xml;charset=iso-8859-1;q=0.2
This tells us that the content-type application/xhtml+xml is preferred, followed by text/html, application/xml, and finally text/xml.
AddDefaultCharsetdirective. If this is not specified, "iso-8859-1" is assumed unless the content type is "text/xml" or "text/xml-external-parsed-entity", where "us-ascii" is assumed.
If no match is found using content-negotiation, the default content type is used.
Note that setting the
AddDefaultCharset directive for the
Apache core is recommended regardless of whether the "charset" parameter
XhtmlNegStarsIgnore directive indicates the
number of stars ("*") in an Accept token that should be ignored
when performing content-negotiation. This is used to get around
bugs in certain user agents that send Accept headers of "*/*"
in every request without assigning them a lower quality value.
Here, Accept headers such as "text/html" or "text/*" will be considered when performing content-negotiation, but "*/*" will be ignored.
XhtmlNegStarsIgnore 0 is effectively the same
as disabling content-negotiation altogether.
3 allows all Accept headers to be used for content-negotiation.
XhtmlNegCache directive controls caching of
negotiated content when the request is sent using HTTP 1.0. By
default, caching is disabled due to problems with HTTP 1.0 proxies
being unable to reliably give user agents the correct content-type.
For HTTP 1.1 (and later) this directive has no effect, since HTTP 1.1 gives proxies the information they need in order to send correctly negotiated content to user-agents.