Originally posted by OwlHoot
View Post
A corollary of this is that you can save yourself a little time by always typing the trailing / as you save a request/response cycle going over the network; though this is more significant if you're on a slow connection, such as a phone with a sub-4G connection.
In fact, the resources denoted by http://example.com/foo and http://example.com/foo/ are not actually the same thing; and it would be perfectly valid to have a document residing at the first that has different content to the document residing at the second. The second, being a container (denoted by the trailing slash), would reasonably be expected to present some kind of index document listing the things contained (e.g. /washing-machines/ is expected to include links to sub-resources about machines that wash) but there is nothing to stop the first having its own content (e.g. /washing-machines returns a 500MB animated GIF of cats vomiting into washing machines).
But, as early web servers were usually serving static content that directly mapped to files and directories on actual disks, and most operating systems didn't allow a file and a subdirectory in the same directory to share the same name, the convention arose that a request for a file that was actually a directory should be redirected to the correct URL for said directory. But strictly speaking "/foo" and "/foo/" are two different things.
Mind you, I've tried to get Apache to stop treating the first as an alias for the second, just for fun, and I seem to recall it was quite tricky; so whoever configured the server you mentioned either really knows what they're doing or, more likely, is so clueless that they've fecked it up quite badly
Leave a comment: