Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

Serve XHTML 1.1 Properly (See related posts)

Place this in a .htaccess file or your Apache configuration. Note that this will redirect noncompliant users to a chosen URL. All XHTML 1.1 pages must be saved with the .xhtml extension.

AddType application/xhtml+xml .xhtml

<IfModule mod_security.c>
    SecFilterEngine On
    SecFilterScanOutput On
    SecFilterOutputMimeTypes "application/xhtml+xml"
    SecFilterDefaultAction "pass"
    SecFilterSelective "HTTP_ACCEPT" "!application/xhtml\+xml" "redirect:http://www.webstandards.org/upgrade/"
IfModule>

Comments on this post

marten posts on May 29, 2005 at 00:49
Hmm, I'd recommend redirecting to a HTML4.0 page of your own with a neater description. Simply redirecting to the WaSP will confuse users, who expect your site to come up.
ubernostrum posts on May 29, 2005 at 03:37
I'd recommend just downgrading to something you can legally serve as text/html, and doing so; this method could easily come off as arrogant and condescending to the user, and that's never a good thing.
weilawei posts on May 29, 2005 at 20:55
Well, that URL simply happened to be the handiest. You're supposed to replace it with whatever you want.
JohnFrazer posts on Aug 04, 2007 at 12:32
Hmmmm.. I found using XSLT output method="html" produced the result I was looking for where I had declared application/xhtml+xml headers. Omitting xsl:output or using a method of xml did not provide HTML formatting.
Over 60% of the web is still using IE6/IE7 so guess we still have to consider them...

You need to create an account or log in to post comments to this site.


Related Posts