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

后端 未结 13 1685
终归单人心
终归单人心 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:38

    Well, file extensions aren't of any use on the internet. The browser doesn't care what the file extension is. You could serve a CSS file as .avi. So why not simply leave it out? This allows for shorter URLs.

    Furthermore "rewriting" a url allows for more readable urls. You may not understand /categories.php?id=455 but you do /455-some-category.

    If you want to do this yourself and are using Apache have a look at mod_rewrite.

提交回复
热议问题