content
Wed, 30 Apr 2003
Do you want sauce with that?
As part of the slow process of improving this website I've been pottering through the recommendations in this W3C document which details various non-optimal website practices. One of the things they discuss is Content Negotiation.
It's not an easy concept to explain so the easiest way is to use and example.
If you have a URI of http://exo.org.uk/colophon (note the lack of a trailing /) then under content negotiation the web server will look at all the files colophon.* and serve the contents of the most suitable one. It uses several criteria to decide which one to serve but most likely it will look at the Accept HTTP header that the client sent. This header lists the MIME types of content that the client can process in order of preference. The server will send the contents of the file whose type matches the most preferred type. If none of the available files match then it will send a default option.
In our example if we have a colophon.txt, colophon.pdf and colophon.doc and the Accept header lists text/plain, application/pdf, text/html we will get the contents of colophon.txt.
This is a bit of a simplification and is based on how Apache handles Content Negotiation. Your web server of choice may deal with it differently. I should point out that you need to make sure the web server knows that a .html file has a MIME type of text/html and so on, although for the common ones Apache generally does know. The relevant Apache documentation has all the information.
Suffice to say that as of now most URIs on this site will not have file extensions.
posted at: 13:27 #