Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Should we always add the final / or avoid it ?


  1. /url-without-trailing-slash
  2. /url-with-a-trailing-slash/

Does it make a difference?

share|improve this question

5 Answers 5

up vote 12 down vote accepted

No difference between them. (As opposed to not putting a slash on links into a directory, for example.) I don't think I've ever seen anything saying that you should or shouldn't, though being consistent in your own behavior is generally not a bad idea, either.

share|improve this answer
+1 the only correct answer here. –  DisgruntledGoat Oct 3 '11 at 14:30
+1 Good answer. –  Book Of Zeus Oct 9 '11 at 23:54
There are differences (relative URIs in the document will be calculated from different places), but none of them are relevant to SEO which is what this question seems to be asking about. –  Quentin 25 mins ago

One of the most wasteful redirects happens frequently and web developers are generally not aware of it. It occurs when a trailing slash (/) is missing from a URL that should otherwise have one. For example, going to "http://astrology.yahoo.com/astrology" results in a 301 response containing a redirect to "http://astrology.yahoo.com/astrology/" (notice the added trailing slash). This is fixed in Apache by using Alias or mod_rewrite, or the DirectorySlash directive if you're using Apache handlers.

from: http://developer.yahoo.com/performance/rules.html

share|improve this answer
But this does not apply to the question example –  leonbloy Oct 3 '11 at 2:25
@leonbloy how does it not? as it shows not only a programmer issue, but given the site you frequent, could mean milliseconds of difference in page load time! –  SpYk3HH 9 hours ago
@SpYk3HH My comment (almost 3 years ago) referred to a previous version of the question, the posterior editions changed (I wonder why) the original meaning. webmasters.stackexchange.com/posts/20373/revisions –  leonbloy 6 hours ago

The other answers have identified that it doesn't seem to technically matter.

For me it is a matter of perception, if there is a trailing slash I'd expect something to be following it, a file name, an anchor.

I also think a lack of a trailing slash looks cleaner.

share|improve this answer

When choosing between using a trailing slash or not, I think that most of the time, no trailing slash looks cleaner. However, I ran across one interesting case in which having a trailing slash can help with search engine optimization (SEO). That is the case that your document has what appears to be a file extension that is not .html. This becomes an issue with sites that are rating websites. They might choose between these two urls:

  • http://mysite.example.com/rated.example.com
  • http://mysite.example.com/rated.example.com/

In such a case, I would choose the one with the trailing slash. That is because the .com extension is an extension for Windows executable command files. Search engines and virus checkers often dislike URLs that appear that they may contain malware distributed through such mechanisms. The trailing slash seems to mitigate any concerns, allowing the page to rank in search engines and get by virus checkers.

If your URLs have no . in the file portion, then I would recommend omitting the trailing slash for simplicity.

share|improve this answer

It's a matter of Apache configuration (can't say about others)

Some Apaches can't handle site/path as site/path/index.file

Semantically both URL declare the same resource

share|improve this answer
It's nothing whatsoever to do with Apache. It's a browser issue. –  DisgruntledGoat Oct 3 '11 at 14:30
@disgruntledgoat- Wrong statement! The DirectorySlash directive determines whether mod_dir should fixup URLs pointing to a directory or not. Typically if a user requests a resource without a trailing slash, which points to a directory, mod_dir redirects him to the same resource, but with trailing slash for some good reasons... –  Lazy Badger Oct 3 '11 at 14:38
the question is not about directories, it's about the root domain. –  DisgruntledGoat Oct 3 '11 at 15:01
Apache is not the only webserver –  slow diver Jan 25 '12 at 18:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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