Trailing Slash

common case

It’s common for URLs with a trailing slash to indicate a directory, and those without a trailing slash to denote a file:

 http://example.com/sub/ (trailing  slash ,conventionally a directory)
http://example.com/sub (without trailing slash,conventionally a file)

In relative urls

  • child relative to /parent/ is /parent/child

  • child relative to /parent is /child

References

When should I use a trailing slash in my urls

To slash or NOT to slash

Why trailing slashes on URLS are important!

  • Only leaf resources (resources with no subordinates) should lack a trailing slash in their URI.
  • If a request is received without a trailing slash, then do a permanent redirect to the URI with the trailing slash.
  • Use relative paths wherever possible (DRY principle).
  • Remember to include the trailing slash in query URIs.
  • Don’t do anything that would prevent consumers of your API using relative URIs.

References

Why trailing slashes on URLS are important