File and Folder Name Convention

Names of files are very important in Web development especially in linking pages and inserting images.  I suggest you to read and print this page.  Use the following information for debugging your codes when you have problems with hyper links and/or images.

Although many web server operating systems (OS's) allow complex file/folder names, there are still many operating systems with limited rules in naming files or folders.   Therefore, it is a good idea to use the rules for the lowest common denominators.

  1. Use lowercase letters.  Avoid any uppercase letters.  For example, Picture.gif is not recommended because of the uppercase letter P.  There are at least two reasons to use lowercase letters only.  One main reason is that some Web operating systems (OS's) such as Unix are case sensitive, which means that they consider upper and lowercase letters as different letters.  For example, a file name apple.htm is considered to be a different file from Apple.htm.  So if you try to link to apple.htm page, using <a href="Apple.htm"> code, it may not work.  Under the Windows operating systems which are case insensitive, the above code does work since the Windows OS's do not differentiate lower and uppercase letters. The second reason is that some operating systems of Web servers automatically change letters to lowercase when you upload files to the server, so that effectively alters properties of internal hyperlinks.  

  2. Names should not be more than 8 characters.  The file extensions (e.g. htm and jpg) do not count for the number of characters.   Reason: Some OS's truncate characters after the 8th character as files are uploaded to the server.  Examples of acceptable names are:  index.htm    home.htm   mypic.jpg   homepage.htm.  * This restriction is getting loose since many Web servers do allow names with more than 8 characters.  However, it is something that you need to find out from the Web master before start developing a site.  Besides that, shorter names reduce the chance of typing errors.

  3. Use only letters or numbers. Do not use any special character, such as *, #, $ and others.  Examples of acceptable names are:  index1.htm    home (as a folder name)     my7pic.jpg   hm1pg2.htm.

  4. The one special character you may use is the underscore character ( _ ), which is the key between the 0 and = keys on your keyboard.   Do not confuse this with the dash ( - ) key.  Examples of acceptable names are:   index_4.htm   my_page.htm   home_page.htm    * The textbook does use the dash character in the file names.  To avoid confusion, go ahead and use the dash character as the textbook instructs. However, I do not recommend using the dash character for general use.

  5. The first character needs to be a letter, and not a number.  For example, 5picture.jpg is not acceptable.

  6. When using abbreviations, be consistent.  For example, once you start using hq for headquarter, you should use hq to represent headquarter throughout the site and should not use any other variations such as hdqt, headqt, or h_q.   Reason:  Of course, there is no technical reason for it.   However, using a number of different abbreviations for one word could cause confusion.

  7. Use htm or html as a Web page file extension.  The current standard is html, but htm is still accepted.  The textbook uses the htm extension.  To avoid any confusion, we will use htm.  Be sure to understand that file names with htm and html are considered two different files.  For example, index.htm and index.html are different files. You may ask why we have two extension formats.   It started with the legacy of 8-3 file name format, that is 8 characters for file name and 3 characters for file extension.  But now the html extension is considered as a standard.

Note:  Many OS's recognize the index.htm or index.html as the main page of the site or the folder.  It means that if an HTML file name is not specified in the URL, the server will display either the index.htm or index.html file.  So, when you enter your web site address without an HTML file name, it will still display the index page from your site.  For example, when you enter without index.html (the file name of the main page) at the end of the URL, it will still display  To see if this is true, click on both hyperlinks.