I read several articles and answers to other questions (including this one ) on how to remove the file extension ( .html , .php ) from the address bar. Now the question is: is it worth striving to do this?

From the point of view of site visitors, the file extension is absolutely useless. What about the technical side?

  • On the contrary, you need to substitute some completely left extension to confuse everyone. Put asp instead of php, Let them think that the site works on asp.net - Sergey
  • Users who are far from web technologies (which are the majority), haven’t heard about php at all. - Hokov Gleb

1 answer 1

I recommend reading w3 .

In many cases, you can remove the extension. Let's say if you need a link to a page, then I would recommend to remove, for example http://example.org/first/ .

But for the content I would recommend to leave. For example, if on the page http://example.org/first/ we have a video, then the link is better to do this http://example.org/first/coolVideo.mp4 , and not http://example.org/first/coolVideo .

The extension also allows the browser to understand what content is in front of it. For example, if you provide a link to an Excel document, for example, it is better to add the extension http://example.org/first/myExcel.xls . Then the browser when downloading will give a choice, than to open this document after the jump. Smart browsers can probably determine this, but not all.

Also, some recommend hiding extensions, as this complicates the hacking process.

If you use CDN, then the extension is also very useful.

  • one
    The extension is not necessary, the type is defined perfectly by the Content-Type header (even first of all by the title, and then the extension). But there really isn't much point in this. The only thing when it was needed is to make private photos, such as in VK (with access rights), otherwise I leave, because in order to remove the extension, you need to use routing at a minimum, which imposes additional costs, instead of giving nginx cheap distribution of static. - Evgenii Izhboldin
  • The extension is not needed because there are mime types. - higimo
  • @higimo I would cut off the testicles of developers who remove extensions from content files. I, as a user, want to open the link / file, see what type it is, etc. - Suvitruf
  • Cut @Suvitruf and do it right. We're talking about scripts, if that. Content time and mim-types to identify the content is enough. - higimo