Trailing slash or not

The “trailing-slash or not” question comes up from time to time, so I thought I’d write something short up.

tl;dr: the slash after a hostname or domain name is irrelevant, you can use it or not when referring to the URL, it ends up being the same thing. However, a slash anywhere else is a significant part of the URL and will change the URL if it’s there or not. This is not SEO-specific, but just how websites work :).

The first part comes from https://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1 , where every request you make to a server must contain a URI, and if you’re asking for the homepage, that would be “/”. You can try this out with “telnet” if you want to feel like a hacker (they’re just normal requests, nothing hacker’y about them :-)): https://docs.google.com/document/d/1P4xnu5xEA7qtQGQRImoUkg1RA0ftTMR8x9pKov-5mE4/view

The second part is essentially a question of asking for a subdirectory or file. Many servers automatically redirect there, which makes it look like the same thing, but you can easily see it by asking for a file with an unnecessary slash, eg. https://www.google.com/humans.txt vs https://www.google.com/humans.txt/ .

Original at https://plus.google.com/+JohnMueller/posts/AUp9ZdAM8Uo

Comments / questions

There's currently no commenting functionality here. If you'd like to comment, please use Twitter and @me there. Thanks!

Tweet about this - and/or - search for latest comments / top comments

Related pages