Re: URL Question

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

 Date:  Thu, 28 Feb 2002 20:26:17 +0000
 To:  hwg-techniques(at)hwg.org
 In-Reply-To:  epa
  todo: View Thread, Original
At 11:03 28/02/02 -0500, Todd.Alexander(at)epamail.epa.gov wrote:
<snip/>
>When it comes to URL's, you'll see a lot of people either end their
>URL's with a "/" and others don't.
>
>For example, http://www.epa.gov/   rather than   http://www.epa.gov
>
>Is there any type of rule or preference out there that is for best
>practices?
<snip/>

Sometimes the trailing `/' matters, other times it doesn't.

http://www.example.com will almost always redirect to 
http://www.example.com/. The redirection will be seamless and almost 
instant. There will be a slight overhead, but not much. If you are getting 
so many hits that this is an issue, you will be needing to look into lots 
of other optimizations too.

I suppose I could set my my webserver to treat http://www.example.com and 
http://www.example.com/ differently, but I don't see any reason to.

The training `/' becomes important when its on the end of a path. For example,

http://www.example.com/path/to/document/ and 
http://www.example.com/path/to/document

are potentially different.

On http://aamcf.co.uk/ I use content negotiation[1] so that the filename 
extension doesn't have to appear on the end of the URI. 
http://aamcf.co.uk/temp/trailingshlash and 
http://aamcf.co.uk/temp/trailingslash/ are different things (for a start 
one exists, the other doesn't)

Interestingly, odd things happen if I put something at 
http://aamcf.co.uk/temp/trailingslash/ as well as 
http://aamcf.co.uk/temp/trailingslash, but I suspect this is due to either 
my ISP's cache being odd or some of the other stuff on my server being helpful.

 From a usability perspective, never make the slashed and unslashed 
versions of a URI point to different things. Its very confusing.

Andrew

[1] Why? see http://www.w3.org/Provider/Style/URI

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

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