• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Missing the oblique from the end of a URL

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    Missing the oblique from the end of a URL

    Hardly ever seems to matter, but occasionally it does make a difference (in my Firefox version anyway) :

    MOD Sales (works)

    404 Not Found

    Any my point is? Well nothing really, just thought I'd mention it.
    Work in the public sector? Read the IR35 FAQ here

    #2
    Originally posted by OwlHoot View Post
    Hardly ever seems to matter, but occasionally it does make a difference (in my Firefox version anyway) :

    MOD Sales (works)

    404 Not Found

    Any my point is? Well nothing really, just thought I'd mention it.
    It depends on how the web server is configured. If you look at the HTTP traffic, you'll find that most servers, when asked for http://example.com/foo and foo is a "directory" (i.e. is intended to represent a container of further resources, though whether or not this maps to an actual directory structure on a disk somewhere is irrelevant) will send a redirect to http://example.com/foo/ which your browser then requests. You'll see the change reflected in your address bar - that trailing / appears there, not as a neat little UI convenience, but because the browser has actually navigated to a different URL.

    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

    Comment

    Working...
    X