Forum Moderators: phranque

Message Too Old, No Replies

how does trailing slash gets added in the homepage?

         

an15h

9:15 am on Oct 30, 2010 (gmt 0)

10+ Year Member



in the forum [webmasterworld.com ] Status_203 tells that:

If I attempt to go to www.google.com in my browser then I end up at www.google.com/ . So where is this happening. Using Firefox with the Live HTTP Headers add on shows me making no request for www.google.com but immediately requesting www.google.com/ . So it looks like the browser recognises that www.google.com is not a valid url but realises that in this case what is actually wanted most often is the root path of the domain "/" and so defaults this part of the path just as it defaults the "http://" part.


there hasn't been any discussion on this after that. when i searched the net and [webmasterworld.com ] forums i didn't find an answer to this.

could you tell how this works in browsers?

the issues are:

1) when i type www.google.com in the address bar, the url automatically gets changed to www.google.com/. in most of the sites it's like the same. www.webmasterworld.com -> www.webmasterworld.com/

the Live HTTP Headers add on of firefox shows that the page requested is www.google.com/
there is no request for www.google.com shown.

does this mean that firefox automatically adds the trailing slash for home pages/root directory and request for the homepage with trailing slash on?

2) how is it with other browsers?

3) is there a tool like "Live HTTP Headers add on in firefox" for other browsers that helps in showing the HTTP header details of the data sent and received?

[PS: it's not the trailing slash problem for directories that is mentioned here, only trailing slash in homepage/root directory]

g1smd

4:37 pm on Oct 30, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



A request for www.google.com would be a request for the www.google.com site, but with no page name specified.

A request for www.google.com/ asks for the root page of Google's site.

The browser must ask for a page, and will do so in the form "GET / HTTP/1.1".

A request for "GET HTTP/1.1" would be invalid; that's why the browser makes the correction for you.

an15h

5:09 am on Nov 1, 2010 (gmt 0)

10+ Year Member



@g1smd: thank you for the reply
that's a good thing to hear..
does all the browsers do the same?

my understanding is that normally when we request for www.example.com/dir where dir is a directory, the server responds with a 301 redirect to www.example.com/dir/ and the browser then requests for www.example.com/dir/

i was wondering whether this is the same case with www.example.com.

but from your comment, i guess browsers automatically requests www.example.com/dir/ when we request for www.example.com/dir

g1smd

8:35 am on Nov 1, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



No.

example.com/this - is the URL for a page.

example.com/that/ - is the URL for a folder or for the index page of that folder.

They are separate URLs.

example.com/ - is the URL for the root folder or for the index page of that folder.

example.com - specifies no page at all, so the browser requests the root page as that was obviously what the user intended.