Re: htm and html extensions

by Andrew McFarland <aamcf(at)aamcf.co.uk>

 Date:  Thu, 18 Jul 2002 20:33:31 +0100
 To:  hwg-techniques(at)hwg.org
 In-Reply-To:  rr
  todo: View Thread, Original
At 14:12 18/07/02 -0400, R & L Rasmussen wrote:

<snip/>
>When, if ever, did the browsers/URL data access world change to the point 
>where no htm or html is required after the server file?
<snip/>

One common way of doing this is by using content negotiation: basically the 
browser requests a URL from the server and the server then finds the most 
appropriate file to send in return. There is, after all, no reason why 
http://www.example.com/foo.html should actually point to a file called 
foo.html.

I use content negotiation on http://aamcf.co.uk/. Currently my CV is at 
http://aamcf.co.uk/CV That points to a file called 
/full/path/to/file/CV.xhtml, which can also be accessed directly by going 
to  http://aamcf.co.uk/CV.xhtml.

Why use the shorter file name? well, suppose for some reason I wanted to 
replace it with a perl script, CV.cgi. I could replace CV.xhtml with 
CV.cgi, but then any links to http://aamcf.co.uk/CV.xhtml would break, 
because that file is gone. The server knows what to do when it is asked for 
http://aamcf.co.uk/CV - it looks for CV.something and then sends the most 
appropriate version to the browser. I can therefore easily change the 
underlying technology behind CV without any links anywhere breaking, and 
without having to worry about setting up redirects.

I recently used this when I switched from gif to png as a graphic format. 
All my graphics were linked as http://aamcf.co.uk/images/foo so when 
foo.gif got replaced by foo.png nothing broke. Even better, I was able to 
leave all the gifs in place, and the server sent gifs if the browser could 
not accept pngs. I had the advantages of using pngs with graceful fallback 
for older browsers.

Content negotiation is a very handy thing, and there are many more uses. 
See the footnote on http://www.w3.org/Provider/Style/URI.html and 
http://httpd.apache.org/docs/mod/mod_negotiation.html

Andrew

--
http://aamcf.co.uk/

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA