What's the forward slash for at the end of a URL?

Discussion in 'HTML' started by xyZed, Mar 3, 2006.

  1. xyZed

    xyZed Guest

    xyZed, Mar 3, 2006
    #1
    1. Advertising

  2. xyZed wrote:
    > www.widget.com
    > www.widget.com/
    >
    > Which one is right and what's the difference?


    Assuming you intended to put an "http://" on the front of those (since a
    relative URL from a Usenet posting doesn't make much sense), then there is
    no difference. They are just different ways of representing the same URL.

    http://www.example.com/foo and http://www.example.com/foo/ would be
    different though (the root of the domain is special). Which one is right
    depends on the configuration of the server. Since such similar URLs are
    confusing a well configured server will redirect one to the other (usually
    foo to foo/ as that tends to map onto a directory containing an index.html
    file).

    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
     
    David Dorward, Mar 3, 2006
    #2
    1. Advertising

  3. On Fri, 3 Mar 2006, xyZed wrote:

    > www.widget.com
    >
    > www.widget.com/
    >
    > Which one is right and what's the difference? (please)


    You talking about URLs published on the WWW? If so then both are
    wrong, unless they're meant to be resolved as relative URLs[1]

    If you meant http://www.widget.com versus http://www.widget.com/ then
    both are correct. The "/" which separates the host part of the URL
    from the local part of the URL is optional when the local part is
    empty.

    Don't confuse that with the trailing slash on, let's say,
    http://foo.example/bar versus http://foo.example/bar/

    Those are two distinct URLs, either or both of which *could* refer to
    distinct resource(s) at the server. Which one(s) are correct depends
    on your server configuration.

    What did you *really* want to know? If you're referring to the sloppy
    habit of typing incomplete URLs into your browser's URL bar, then the
    rules are whatever the browser developer has implemented, since *that*
    would be of purely local significance.

    have fun

    [1] in which case they'd be resolved relative to the absolute URL of
    the page which referenced them, let's say
    http://www.foo.example/some/path/to/www.widget.com , with or
    without a trailing slash.
     
    Alan J. Flavell, Mar 3, 2006
    #3
  4. xyZed

    Toby Inkster Guest

    Toby Inkster, Mar 4, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Greg Collins [Microsoft MVP]

    Links to https fails 404 with preceding forward slash

    Greg Collins [Microsoft MVP], Jun 14, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    435
    Greg Collins [Microsoft MVP]
    Jun 15, 2006
  2. Stephen Ferg
    Replies:
    30
    Views:
    942
    Andrew Dalke
    Sep 30, 2003
  3. Tony Meyer
    Replies:
    1
    Views:
    634
    Stephen Horne
    Sep 26, 2003
  4. destroooooy
    Replies:
    4
    Views:
    658
    Arnaud Delobelle
    Apr 29, 2008
  5. harryos
    Replies:
    2
    Views:
    1,707
Loading...

Share This Page