开发者

Difference between hello/ and hello in file names, URIs

What's the difference between using the name of a directory and using it's name with a trailin开发者_高级运维g dash (hello vs hello/). It seems to matter a lot in web development.


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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜