When you select a URL that points to a directory on a webserver
it should have a trailing slash. That is because that is
part of the definition of HTTP and is needed to be that way
so that browsers can work out what relative URLs are relative
to.
So what goes on behind the scenes when someone specifies a URL for a
directory without the trailing slash, like http://www.cranfield.ac.uk/ccc ?
- Browser contacts www.cranfield.ac.uk and asks to
get /ccc .
- The server at www.cranfield.ac.uk notices that there
is no normal file with that path and strictly speaking would have
the right to say, "Document not found".
- But being a nice friendly cooperative sort of server, it will
check to see if there is a directory by that name. It finds one.
- It can't just supply the document for that address, since then
the browser would think that it was looking at a file instead of
a directory and would get all of its relative URLs wrong.
- So the server tells the browser that it has requested an
incorrect location and that it should request
http://www.cranfield.ac.uk/ccc/ This is called a "Redirect".
- The browser says OK. And makes a new connection to
www.cranfield.ac.uk and asks to get /ccc/
- The server sees that it does have a directory by that name
and supplies the browser the normal stuff it does for a directory
request.
That is usually a directory listing or the
contents of a file called index.html or file of some
other distinguished name.