Running a Nibbler analysis on a static website I just built, I got the following feedback:
Avoid use of file extensions wherever possible. File extensions appear at the end of web addresses, and have several negative effects. They make the address harder to remember or type (particularly for non-technical users), and can reveal the underlying technology of the website making it very slightly more vulnerable to hackers. They also tie the implementation of the website to a specific technology, which can make subsequent migration of URLs difficult.
The above message is a result of having a flat directory structure and linking directly to the individual web pages (whatever.html). So is it really that much better to put every html file on a website in its own personal subdirectory (giving every webpage the file name index.html and relying on the directory name to identify the file) vs simply linking directly to the individual html files? I did some searching but didn't really find anything useful. This discussion had some info but didn't answer my question.
I'm curious to know what folks think of the two different approaches. Thanks.
/file-name/is a directory./file-nameis a file. – Rob Sep 07 '21 at 09:42.htmlfiles/URLs ("harder to remember or type" - perhaps, but debatable - see trlkly's comment above). (It would be more relevant to.phpor.aspURLs etc. but even those can be worked around.) There was even a trend a few years ago to go back to using.htmlURLs. – MrWhite Sep 07 '21 at 13:01/~johndoe/convention, and you could say that is a directory too, which is kind of true, except that the directory is not called itself~johndoebut more probably/home/johndoe/, and this shows the abstraction/level of redirection (unrelated to HTTP redirections) – Patrick Mevzek Sep 07 '21 at 18:12ApacheAliasdirective for example that shows that any filesystem path can appear under any URL. There is no 1:1 mapping, as there is no need to. – Patrick Mevzek Sep 07 '21 at 18:19