How come some site urls do not include a file extension?

后端 未结 13 1776
终归单人心
终归单人心 2020-11-28 09:38

I was browsing the internet and noticed, YouTube, for example, contains a URL like this to denote a video page: http://www.youtube.com/watch?v=gwS1tGLB0vc.

13条回答
  •  悲&欢浪女
    2020-11-28 10:34

    The url, should properly be considered part of the user-interface. As such, it should be designed to convey information about where the user is on the site, and the structure of the site.

    A url such as:

    mysite.com/sport/soccer/brazil_wins_worldcup

    tells the user a lot about the structure of the site, and where he currently is. In contrast:

    mysite.com/article.php?cateogry=12&articleid=371

    is useless, instead it exposes irrelevant implementation-details such as which language is used to make the site, and what the id of that article is (likely stored in a database under that id)

    In addition to this estethical argument (don't expose the user to irrelevant implementation-details) it also helps with making the site future-proof. Because if you never exposed your language of choice to begin with, you can later upgrade to Ruby or Python, without every link in the world that points to you, now being a 404.

    Design urls to make sense for users, and to be future-proof.

提交回复
热议问题