DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Abdul-Jabbar Bozdar
Abdul-Jabbar Bozdar

Posted on

What's wrong with URL extensions?

Static websites are on the rise due to their server rendering and progress approach. Devs are choosing one static site generator to another to keep their clients flexible. If found none, they develop their own.

I want to know, what's wrong with developing plain static web sites as same as the 90s which have .html extension in their URLs? We can make them too part static and part dynamic as we do while generating PWAs. What's ugly with URLs which end up with an extension like .html, .php, and .aspx?

Thank you very much for your time.

Top comments (1)

Collapse
 
ahferroin7 profile image
Austin S. Hemmelgarn

I wouldn't say it's ugly, but I absolutely think file extensions in URL's are a bad thing unless it's files that you expect the user to download.

Short list of reasons they're a bad thing in general:

  • It really doesn't benefit the user at all in almost all cases. You should be sending a correct MIME type in the Content-Type header, so unless their browser is braindead, the extension just doesn't matter unless they're downloading the file and using Windows (because Windows is too stupid to look at the contents of the file to figure out what type of file it is).
  • It makes the URL longer without actually adding any useful information. Short URL's are important because they're easier to remember, easier to type correctly (usually), and easier to encode into things like QR-codes.
  • If the extension is backend-specific (.php, .aspx, etc), you're actually making it harder to switch your tech stack if you ever need to (and more likely for such a switch to cause issues for your users).
  • Also, if the extension is backend-specific, it's almost always lying about what the page is. You don't send people PHP or ASP.NET code, you send them HTML. Classically, they were used for matching requests for dynamic pages without needing a fixed prefix for the path, but modern web servers can trivially be configured to try a sequence of ways to retrieve a page (and then cache which way worked to save time on subsequent requests), so you don't need to do that anymore.

An Animated Guide to Node.js Event Lop

Node.js doesn’t stop from running other operations because of Libuv, a C++ library responsible for the event loop and asynchronously handling tasks such as network requests, DNS resolution, file system operations, data encryption, etc.

What happens under the hood when Node.js works on tasks such as database queries? We will explore it by following this piece of code step by step.