Naming Files

The Importance of index.html

When you send a request for a server directory instead or a specific file, the server searches for a file named "index.html" or "index.htm" in the directory. If it doesn't find one, it will generate its own. Try looking in this directory: http://art.wallyzone.com/dm60a/tutorials/no_index.

Name the "home" page in your main directory index.html. This allows you to determine what you want your user to see via the links on that page rather than allowing them to browse through your files like the link above. Also place an index.html file in each sub directory that you do not want browsed.

Some Good Ideas

You will make your life much easier if you follow a few general rules when it comes to file names. Although these hints are slanted towards UNIX servers, they are also good for use on others.

  • All of your web page files for this class will end with a ".html" or ".htm" suffix. This informs the web server of the type of file it is and your web browser how to display the page.
  • Keep the names simple and descriptive. Notice this html file is names "files.shtml." Easy for me to remember something about the contents without having to open it.
  • On UNIX servers (such as the one we are using, webhawks.org), files names are very case sensitive. Working locally on your desktop PC or Mac, files are not case sensitive, so you can be fooled until you upload them. Fun.hTmL does not equal fun.html.
  • Spaces count as characters in a file name. LEAVE THEM OUT! Use an underscore "_" or dash "-" instead. my_cat.html works, my cat.html doesn't.
  • Leave out special characters. Inch marks ", foot marks ' , < , > are all used in your coding. The ?, %, &, and others can be used for other functions such as querying a database. Stick to the basic "-", "_", and "." and simplify your life.
  • If you are working on both Mac and PC platforms, use the DOS 8.3 convention. That is eight or less characters before the "dot" and three or less after. This is important if you are copying files on a PC to a ZIP or floppy disk and transferring them to a Mac. The Mac will truncate long Win95+ file names to the DOS pattern. (This last point seems less of an issue with XP and OS X although it is still a good idea to check if you find problems which only show up on campus.)
bottom graphic for DM 60A pages