Welcome to WebmasterWorld Guest from 54.167.40.25

Forum Moderators: martinibuster

Message Too Old, No Replies

Link Path to Root

Include trailing / ?

     
10:56 am on Mar 23, 2002 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member pageoneresults is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Apr 27, 2001
posts:12166
votes: 51


When providing an outgoing link that goes to the root, is it a good practice to use the trailing forward slash?

i.e. http //www.domain.com/

11:17 am on Mar 23, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 22, 2001
posts:2044
votes: 0


I use it all the time now, though I can't really rationalise it.

Started when I noticed all the other sites in a MSN directory category had one.

They turned up in the non directory search serps, I didn't.

1:12 pm on Mar 23, 2002 (gmt 0)

Senior Member

joined:Sept 1, 2000
posts:1120
votes: 0


As an ODP editor I've been adding the trailing slash since I started. It was an upper level editor that started it for me and I followed suit. Now, it's a habit with me and I always include it.
2:10 pm on Mar 23, 2002 (gmt 0)

Junior Member

10+ Year Member

joined:Feb 21, 2002
posts:160
votes: 0


yes it's a good idea because......

(1) it doesn't cost you anything to do it

(2) it ensures that spider programs have no excuses about having problems crawling past that link.

(3) there's an unlikely problem that Apache web servers can have if you leave it off.
more info at [httpd.apache.org...]

3:09 pm on Mar 23, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Aug 10, 2001
posts:1550
votes: 10


I used to assume that the "/" was required by the HTTP standard, but upon checking rfc2616 I found the issue to be slightly blurry, requiring it in some cases, but making no clear statement in others.

All the same, there are good technical reasons to always include it anyway. A full URL specifies a resource on the net by (at least) three parts:

  • The "scheme" or protocol (http://, file//, ftp://, mailto:, etc.)
  • The hostname (www.example.com)
  • The path (/...)
    So far that's nothing new to anyone.

    Now what happens if one of those parts is left away?
    If the protocol is left away, the browser will assume http.
    If the hostname is left away, the host that served the current document is assumed (relative URLs).
    If the path is left away, then most browsers won't do anything about it.

    This means, that they'll send the request to the server without the /. Since the server can't send a document without a path (such a document doesn't exist), it will then assume that the client actually meant the root path of its namespace. However, it will not simply send that document. Instead it will send a 301 redirect reply, asking the client to repeat its request with the / included.

    The result is, that for such an URL, not one request has to be sent, but two. Therefore, if you want the pages you specify with your URLs to load faster and with less strain on the network, make sure to always include a path. If you don't, then the server will most likely correct your omission, but it will cause more work for all systems involved.

  • 1:32 pm on Mar 24, 2002 (gmt 0)

    Senior Member from US 

    WebmasterWorld Senior Member pageoneresults is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

    joined:Apr 27, 2001
    posts:12166
    votes: 51


    Thanks to everyone who contributed. I am currently on a find a replace mission! Believe it or not, I know you guys/gals hate FP, but FP2002 adds the trailing slash by default. That is the reason I brought this topic up, previous versions did not do that, not that I recall anyway.
    8:36 pm on Mar 24, 2002 (gmt 0)

    Preferred Member

    10+ Year Member

    joined:July 20, 2001
    posts:449
    votes: 0


    I looked into this once myself and have since been following Nielsen's recommendation:

    [useit.com...]

    He advises leaving the / in your HTML, because if you just put (say) mydomain.com/news the server has to perform one more lookup operation to discover that that mydomain.com/news maps to the directory mydomain.com/news/ rather than to a file. This adds a tiny bit to retrieval time. Some people would say this doesn't matter, but it's one of those things: if you chop out ten or fifteen things that cause a tenth of a second delay in loading your page, then people subliminally start noticing that your page loads faster.

    And by contrast, any address printed or displayed for human consumption should not include the trailing slash: a reader of the page should just see mydomain.com/news, which is cleaner and easier to remember (the code behind the link can include the trailing slash).

    3:04 am on Apr 4, 2002 (gmt 0)

    Junior Member from AU 

    10+ Year Member

    joined:Oct 20, 2001
    posts:167
    votes: 0


    Greetings and gidday from downunder folks,

    I always wondered why the ses coming to index often appeared to log my root twice, now I know why. I manually submit and always removed the trailing /, now I won't!

    Always makes me happy to reduce bandwidth load, (however miniscule) rather than contribute to it!

    A most informative thread. Thanks to everyone.

    cheers and hooroo
    JP