Lecture 6: Proper File Naming
Overview:
- File Naming Conventions
- The index.html Page
File Naming Conventions
Follow these standards in naming files (.htm/.html files, .css files, and images) as well as directories:
- Keep names simple, short, and meaningful.
- Use all lower case; names are case-sensitive on the server so using a consistent style minimizes errors.
- Always include a file extension (e.g., .html, .htm, .css, .gif, .jpg)
- Never have spaces in file or folder names, because the web server will replace that space with a %20. If there are two words, separate them with a hyphen or underscore.
- Name the top page of any directory index.html, so that file loads automatically when the directory is visited.
- Stick with conventional characters. Do not use any of the following characters: ~ @ # $ % ^ * ( )
The index.html Page
- If there is no index.html page in a web-accessible directory on the student server, a listing of all the files and subdirectories in that directory is displayed when it is visited online. Note that some servers disable this index listing and show an error message or access denied message, but not the student server.
- To illustrate this, point your browser to your inp150 directory online: http://stu.wccnet.edu/~username/inp150/
- The web server looks for the index.html file as the default page to display, which results in shorter URLs (you do not have to type in index.html).
- Having an index.html page also protects your files from snooping eyes.
- The index.html file does not need to have any special content in it; just the correct file name so the server can load it by default. The file extension can be .htm; that would be fine (the file would be named index.htm)