Web File Naming Conventions
When creating a website, you must be very methodical when naming your files.
First, never use spaces, uppercase letters, or any special characters in your file names.
While your site may seem to work okay using an HTML editor (i.e. Dreamweaver) on your local computer, when you upload the website on the server, violating these rules can cause lots of problems.
For webpage file names, be sure you use “index.html” for the first webpage (commonly referred to as the home page) of your site. Using this special name will tell the server to display this page as the first page (default page) for your website.
Other HTML files should have descriptive names such as products.html or about_us.html, rather than meaningless names such as page1.html. Name your files as if you’re giving the website to someone else to work on, and often you will hand off files to others.
Here are the standard naming conventions:
- No spaces in the filenames. Use an underscore or a dash instead of a space.
- Most often, use all lowercase letters. Or at the very least, be consistent. Most Web servers are case sensitive so “cat.jpg” is a different file than “Cat.jpg.”
- No special characters in the filenames: For example none of the following are acceptable in web filenames: “!~:&(,
- The files MUST have the proper suffix (.html, .gif, .jpg)
- Be consistent in your naming of files, for example use the same prefix in a series of files. Also, to ensure that the files alphabetize correctly, always “zero-pad” your filenames when they have numbers in them. In other words, if you have a series of files numbered 1-20, the first file should be something like casestudy01.jpg, and the last file should be named casestudy20.jpg.
And again, it’s critical that you name your files correctly from the start. If you attempt to rename your files after you’ve created your site, you will, in all likelihood, break all the links in your webpages.
File names have implications for your Search Engine Optimization (SEO) so name your web files wisely.
Descriptive filenames help you recognize what content the file contains and helps with SEO. Remember the following:
- Use keywords in your filenames
- Use actual, descriptive words (i.e. black_cat.jpg instead of img01.jpg)
- Shorter is better for filenames