2

From an SEO perspective, it may be negligible if you include a trailing slash for directories or not, as long as you set redirects to the chosen one (to avoid duplicate content) and link-build to the right one:

example.com/about/
example.com/about

Other authors suggest that it's best to avoid a redirect and that a trailing slash is typically for directories (folders), while a lack thereof implies a file.

But what about the user's perspective?

Is there any research on the best practice? What do users expect? (If anything.)

2
  • +1 for interesting question. I've always included trailing slashes when writing code or communicating an URL (even when it looks like a directory name but results in serving a file) and never considered if there were any file vs. directory conventions.
    – obelia
    Commented Dec 8, 2012 at 19:56
  • Doesn't make a blind bit of difference, but it feels weird to have a slash at the end... for exactly the reason you mention: no slash = file and a page sort of implies a "file" Commented Dec 8, 2012 at 19:56

2 Answers 2

2

Case 1:

A slash indicates a directory. The lack of a slash indicates a file. Obvious cases:

Case 2:

What is less obvious are the cases where URIs are not mapped directly to the file system. For example:

Conclusion:

Append a slash if:

  • The target is listing something (like a set of files in a directory or a bunch of products on an e-commerce website), or:

  • The target expects to be completed to form a more complete URI.

Note that in practice, nobody, among the users, care if there is a slash or not. If the URI is typed, most users would omit the slash. If the URI is a link, few people will read it, and even fewer try to assert something from the presence or the absence of a slash.

Also, you're free to use whatever convention feels natural for you. For example, Stack Exchange seems to avoid using a slash as much as possible, probably to shorten the URIs.

3

If you think of the web as files put in folders that are listed in a certain hierarchy on a web server, pretty much like how a book is organized, you know that every web page you see is actually a page and not a folder. The same goes for a book... if someone told you to open up chapter 5 of the book - you would go to the first page of chapter 5 and not any random page or the last page.

Users know that they open a page, but not necessarily how the page is named. In this case I would end URLs' with either a trailing slash representing a folder, or writing out the entire file name as well as in http://www.example.com/about/index.html.

More to read: Trailing slash in URLs - which style is preferred?

0

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.