Best practice for naming files in Linux

If you are developing your website and you cannot find out why your pages, images, JavaScripts, and other web data is causing a 404 error not found, you may have a problem with case sensitivity.

Linux servers are case sensitive. Windows servers are not case sensitive, so if you are moving your files from a Windows development platform to a Linux web platform you may need to watch out for the following common mistakes.

Common Case Sensitive errors

Mixing Upper case and lower case

A common mistake is naming files a mixture of upper case and lower case. Like the following:

MyFileName.html

Linux reads the file name exactly the way its typed. So,

MyFileName.html

Is NOT the same as:

myfilename.html

Incorrect types file extension

File extensions are case sensitive as well. Some file types have 4 letters and others 3. See the following example:

Likewise, file extensions need to be exact as well:

MyFileName.HTML

Is NOT the same as:

myfilename.html

Also, image extensions must be the right type:

image.jpg

Is NOT the same as:

image.jpeg

Best practices for Linux file naming

To prevent running into problems with your file paths on your site, we recommend following the best practices for file naming. See the below:

  1. Name all your files lower case.
  2. Instead of using a space, use an ( _ ) or a ( – )
  3. Use consistent file types. Use jpg or jpeg. Don’t use both.
  4. Only alphanumeric characters, periods, underscores and hyphens and don’t use symbols like “%”, “$”, and so forth.
  5. Keep the file names short and descriptive.

Was this article helpful? Join the conversation!

Questions about our MailChannels Deployment? We have answers and are here to help!Learn More
+