Naming Conventions, File Structure and URLs

Don't worry - I'm not going to go too deep here - but you will need some knowledge of naming conventions, file structure and the anatomy of a URL! Let's start with the file structure.

Basics of File Structure

  1. Each drive on a computer has a name. For example, the hard drive on the PC that you are working on is the c drive and the server drive where you save your files is the h drive.
  2. Each drive is divided into directories or folders that are also given names. When we talk about a directory on a drive, we separate the drive and the directory name with a back slash ("\"),
    e.g., h:\givenss.
  3. Directories (or folders) can have subdirectories (a directory inside of another directory). Again, when we talk about drives, directories and subdirectories, we separate each with a back slash ("\"), e.g., h:\givenss\htmlfiles.
  4. Files are stored inside of directories or subdirectories. A file can be any type of a file: a word document, a graphic or an html document. Graphic files are stored in a separate subdirectory (named images or graphics). An example of a file in a subdirectory is: h:\givenss\htmlfiles\mypage.html.
  5. Notice that we are using back slashes ("\"). In Notepad (or the Windows environment) when you want to open/save a file by entering the drive and directories as well as the filename, you use a back slash. But when you access directories on the Internet or in your HTML code, you use forward slashes ("/"). This can be a little confusing at first, but you will get used to it.
Naming Conventions
  1. In the days of DOS (before Windows), file names could only be 8 characters long plus a three character extension. File names can now be much longer and may contain spaces. Windows file names still have a 3 or 4 character extension, but you may not always see it. For example, Word documents have the extension .doc appended to the file name and HTML documents have .htm or .html appended to the file name, but Windows has an option to show (or not show) the extension.
  2. When creating HTML files for the Web, you can use either .htm or .html. If you upload to a Unix server, you should use the four-character .html extension. The main thing is to be consistent. Do not mix .htm and .html on your website! (Unix servers see these as separate files.)
  3. Never, never use spaces in your HTML directories or file names. Some browsers see a space as "%20", making it difficult to link to the file.
  4. Be consistent in your naming conventions. It is best to use all lower case or a file name like "aboutSequoia.html". (By the way, there are very strict file-naming conventions that help identify the type of file as well as the file name.)
Anatomy of a Uniform Resource Locator (URL)
  1. A URL is just an address for a web page. Nothing more.
    A URL looks like: http://www.seq.org/~sgivens/lessons/week2.html. But what does it mean?
  2. The initial page of a website is usually named index.html. It is a good idea to have an index.html page in each directory because index.html is the default page for the directory. It prevents users from dropping into a list of files in that directory if they do not enter a document name.

    Back to the Week 2 Schedule