I am asking this because whenever I hover over a link to a home page (e.g. http://www.example.com), I notice that a trailing slash is always added (as observed on the status bar of the browser) whether the home page link contains a href attribute that ends with a slash or not. But whenever I am on the home page, the URL on display will not have a trailing slash.

I tried entering a slash to the URL in the URL bar. And with Firebug enabled, I notice that the site always return a 200 OK status. An article here discussing this states that having a slash at the end will avoid a 301 redirection. But I am not seeing any redirection, even on this page.

Could this be a browser feature that is appending the slash?

  • Yes. For example, I think Opera hides the forward-slash (and it also hides the protocol sometimes which drives me crazy on dev!) ...
    – Matt
    Commented Oct 14, 2012 at 6:02
  • What exactly is the question here? (Or the point of the question.) And what is "the" site you're referring to? If you check right here with webmasters, for example, you'll note that in Firefox and Chrome(I'm not doing a full round of testing), what you describe as far as a slash being added doesn't happen. It actually seems to force the slash to be removed if you try and add one, for that matter.
    – Su'
    Commented Oct 14, 2012 at 10:23
  • @Su', I am referring to any site and status bar refers to the one displayed at the bottom of any browser and URL bar refers to the address bar at the top. Sorry if I have caused you confusion. Commented Oct 14, 2012 at 12:12
  • 2
    @Matt Opera also hides the query string (bit after ? in the URL) which is pretty silly IMO. Commented Oct 15, 2012 at 10:27

1 Answer 1


Yes, all mainstream browsers "append a slash" to the HTTP request when requesting a bare domain URL (ie. the homepage). This is actually necessary in order to make the HTTP request valid, which for http://example.com/ is:

GET / HTTP/1.1
Host: example.com

Note the / (slash) in the first line - this is the URL being requested. It is not valid to have nothing here. From RFC 2616:

Note that the absolute path cannot be empty; if none is present in the original URI, it MUST be given as "/" (the server root).

You need to look at the HTTP request the browser makes to the server. The URL displayed in the "status bar of the browser", or even the URL in the address bar could be different - more user friendly. Google Chrome does not append the trailing slash in the status bar, although the slash is present in the request.

No 301 redirect occurs if you specify http://example.com (no slash) because the browser corrects the HTTP request before it is made.

Note that this is different to slashes being added to the end of URLs when there is a path/directory. eg. http://example.com/directory/. The article you link to seems to treat both the same and does not appear to be entirely correct IMO. If you requested http://example.com/directory (no slash) then the browser does not append a slash and yes, most servers will 301 redirect to http://example.com/directory/ (slash) - but this is dependent on the server; it could simply break! On Apache, for instance, this is dependent on DirectorySlash On being set (which is the default).

  • To add to the answer, whenever you are linking to your home page add the trailing slash to save server resources.
    – Anagio
    Commented Oct 14, 2012 at 14:53
  • 9
    @Anagio I don't think you understand the answer. You wouldn't save server resources at all because there is no redirect. A domain with and without the slash is 100% identical. In other words, there is absolutely no way to return different content for each (which you can do with directory URLs). Commented Oct 15, 2012 at 10:32
  • 1
    @DisgruntledGoat if you leave off the trailing slash and the server redirects then adding a trailing slash in links would save the server from having to reload to the page. That's all I was getting at, to put this slash talk to rest Google has a great article on it googlewebmastercentral.blogspot.com/2010/04/…
    – Anagio
    Commented Oct 15, 2012 at 10:45
  • 7
    @Anagio That article is about trailing slashes for directories, whereas this question is about a trailing slash on the domain only. As the above answer states it makes zero difference, because a link to example.com or example.com/ both require the exact same request to the server. Commented Oct 15, 2012 at 10:54
  • 3
    … because the browser will "correct" this.
    – unor
    Commented Oct 15, 2012 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.