views:

31

answers:

1

What's the difference between using the name of a directory and using it's name with a trailing dash (hello vs hello/). It seems to matter a lot in web development.

+1  A: 

The trailing slash indicates that "hello/" is a directory.

A web server that sees "hello/" will either serve you up its directory listing contents or the default page for a directory called "hello".

  • If a default document is configured for that directory, the web server serve it up to the client.
  • If a default document is not found or is not configured for that directory, the web server will list the directory's contents.
  • If there is no default document and the server is not configured to show you directory contents, you will get a 403 (Directory Listing Denied).

No trailing slash indicates that "hello" is a file.

A web server that sees just "hello" will try to serve you up a file called "hello". It it can't get that file, it will give you a 404 (Not Found).

Dave Markle