26 Oct 2007

SDF "Content-Type" Silliness

I discovered something interesting about the SDF’s web server today: it doesn’t seem to have a rule set up for serving .xhtml content by default.

I didn’t notice this initially, and my XHTML pages were coming through okay, because they use the “http-equiv content-type” meta element. But a quick check with the Web Sniffer revealed that they were actually being sent with a content-type of text/html, rather than the correct application/xhtml+xml. I would have thought that this would make them fail to validate cleanly, but apparently since the media type is a “SHOULD” rather than a “MUST,” it doesn’t fail. Or maybe it uses the META http-equiv and ignores the one actually coming from the server, for purposes of validation. I’m not sure.

Inserting AddType application/xhtml+xml .xhtml into my .htaccess file in the root ~/html/ directory solved the problem, and now my XHTML pages (mostly static articles produced using MultMarkdown from plaintext) are served correctly.

Anyway, just something for other people to note, I guess. I don’t know what accepted best practice is in this area, but I think I’m going to go and explicitly specify the content-type that I want transmitted for all the various file types that I use on the site, just to make sure; the way things are looking, I’m going to end up with a mix of plain text (including some UTF-8), XHTML, and plain old HTML.

This entry was converted from an older version of the site; if desired, it can be viewed in its original format.