It’s just data


Jacques Distler: You either have to be a programming whiz, a deranged physicist, or some equally atypical character, who’s willing to cobble together something half-way bulletproof.

For the record, despite all of my efforts, when Evan went to check, my setup had ***GASP*** stopped serving my main page with the appropriate mime type to standards compliant browsers.  The problem appears to be an unfortunate interaction between DirectoryIndex and Mod Rewrite (i.e., the former stomping over the latter's mime type instructions).  I believe that this change happened without my participation, i.e., some random system upgrade caused this change in behavior.

After a bit of frustrating experimentation, I couldn't find any way to get DirectoryIndex to either gracefully get out of the way or to behave, so I decided to mod rewrite it out of the equation.

So... if you are following anything remotely related to these instructions, you might consider adding something like the following lines to your .htaccess file:

RewriteBase /blog
RewriteCond %{REQUEST_FILENAME} /$
RewriteRule (.*) /blog/$1/index.html

Rather than mucking around with mod_rewrite, I installed [link] the other day.  It negotiates the right mime type according to the Accept header and appears to be pretty shiny.  Apart from the ghastly mozilla display of non well formedness.


Posted by Dominic Mitchell at

Your post title reminds me of a saying we had back in the days when I worked in graphic arts / print publishing:

"Eternal vigilance is the price of Postscript."

It would certainly seem to apply to XHTML.

Posted by d.w. at

You can do better yet. With a couple of -X tests you can obviate the need for mod_dir entirely and duplicate all of its functionality with rewrite rules.

First, use a -d test to issue the redirect from /foo to /foo/ that's necessary for directories requested without a trailing slash.

RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.*[^/])?$ $1/ [R]

Then, second, use -f tests to duplicate mod_dir's ability to pick from a range of possible index file names.

RewriteCond %{REQUEST_FILENAME} /$
RewriteCond %{REQUEST_FILENAME}/index.atom -f
RewriteRule ^(.*)$ $1/index.atom

RewriteCond %{REQUEST_FILENAME} /$
RewriteCond %{REQUEST_FILENAME}/index.cgi -f
RewriteRule ^(.*)$ $1/index.cgi

RewriteCond %{REQUEST_FILENAME} /$
RewriteCond %{REQUEST_FILENAME}/index.shtml -f
RewriteRule ^(.*)$ $1/index.shtml

RewriteCond %{REQUEST_FILENAME} /$
RewriteCond %{REQUEST_FILENAME}/index.html -f
RewriteRule ^(.*)$ $1/index.html

# etc...

This is largely untested but should be fairly close.

Note that Apache will pick the response MIME type according to the type associated with the file that gets rewritten to.

It should be possible to associate all these files with application/xhtml+xml by default and then before the rules which rewrite to a HTML file insert one which that changes the MIME type to text/html if the browser doesn't advertise support for that MIME type.

Posted by Aristotle Pagaltzis at

The X-Philes

The X-Philes, a list of XHTML valid sites. Via Jacques, via Sam. I'm going to ask to be added to the list. My site isn't bulletproof because I don't strip control characters (which I should). I also deliver MIME types other than...

Excerpt from Keith's Weblog at

Mesothelioma is one of the most chronic disease like cancer and tumor if you want to get aware of it then from here get the causes symptoms and diagnostic of mesothelioma disease.

Posted by asbestosis at

Add your comment