开发者

Advantage of placing webpages in separate directories?

My question is there really an advantage by placing each webpage in it's own directory compared to putting them in a directory?

( www.example.com/ and www.example.com/b.php ) vs (开发者_如何学Go www.example.com/ and www.example.com/b/ )


What you've seen is probably not that each file is in its separate folder, but rather a rewriting/routing engine in action. The basic concept is that you tell the server that "a URL that looks like <this>, should point to a file with a filename like <this>, and with <these> parameters". This way, you can create easily readable URLs (which benefit both users, developers and search engines).

Example:

A user types in domain.com/cats/Garfield/. This could be interpreted as domain.com/index.php?category=cats&cat=Garfield by the server. Thus, the "usage URL" is far cleaner and easier to read and remember.

More info in the Wikipedia article about URL Rewriting.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜