简体   繁体   中英

Using multiple dots (.) in file names

Are there reasons not to use multiple . in website file names (images, css files, js files...) like in logo.french.png ?

Too bad that answers cannot be so short: No.

Update:

Mmh ok let me think (you wanted that!):

  • URLs don't restrict the uses of periods in the path.
  • The normal file naming restrictions of the OS your server is running on apply.
    If you run Linux or UNIX then you should be pretty free in naming your files (regarding periods). Windows, not so sure ;)

Update 2:

There might be some special configurations of your web server (like Apache's content negotiation ) that also uses several periods in the filename to distinguish content. But that should not interfere with naming your files this way.

No.

The only reason I can think of to not use multiple . 's in a filename is that a very poorly written file-extension checker might get confused.

Yes.

I had a file on my website named ads.atx.ps.960.jpg, referenced inside an img src tag... that spot came up blank in both Chromium and Firefox on Linux when I retrieved the page. When I finally out of desperation changed the name to ads_atx_ps_960.jpg, it worked fine.

I don't know if the problem was with the browser or the web server, just know it didn't work with the dots, in either browser. My query for the server type returned "Apache/2"

Note that I do also have a bunch of html files with multiple dots in the names, things like yocto.file.copy.html, etc... these are referenced in href tags and all work fine, the first time I saw the problem was with the JPG in an img src tag.

We do use webpack.config.js file name in our javascript projects to configure webpack. So, it is not a general scenario.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM