Skip to content

Everybody needs a 303

So there’s a lot of debate the past few days about the issue of 303’s being one of the two accepted ways to get from a URI for a non-document (eg. the City of London) and for a document about that thing (london.rdf or london.html etc.)

One of the key points Ian Davis made is that it must be practical for people on crappy ISP setups (or who’s computing services don’t let them touch their server configuration etc. Ian Davis and Leigh Dodds have done some useful work suggesting workable patterns for people to follow, and I think what’s needed next is a ‘cookbook’ of how to achieve these patterns using available tech.

With this in mind I’ve been trying out solutions and would like to present a simple solution for how (nearly) everybody can have a 303. I’ve tried this on apache on local Redhat Enterprise and Ubuntu servers, and also on the server on Dreamhost — it works on those. It nearly worked on the apache setup which comes with OSX, except for the fact it redirected with a 200 rather than a 303.

What you do is put your RDF files in a directory; eg. /project/people/marvin.rdf and define the URI for marvin as /project/people/marvin

Put as many in as you like then add this .htaccess file:

RedirectMatch 303 (.*)/([^\./]+)$ $1/$2.rdf
<Files ~ ".rdf">
 ForceType application/rdf+xml

The first line just redirects *anything* without a dot “.” in to the same address with .rdf on the end. This means that /foo will direct to /foo.rdf and then 404, but who cares? The second bit just makes sure that the mimetype is correct if the server doesn’t do the right thing with .rdf

There are better ways to do this, but this works on a pretty vanilla, and locked down, apache set up.

So there you go, one less excuse. Link that data!

Posted in Uncategorized.

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Some HTML is OK

or, reply to this post via trackback.