Bruce's Web Lab

Naming Web Site Files



Correctly Naming Web Files

Web browsers interpret many types of files and represent them in different ways. HTML files make up the basic content and layout of a web page, and provide the framework for presentation of other file types (graphics, sounds, video, etc.). All HTML files must be named in accordance with the following conventions:

  1. HTML file names must end in .html or .htm ;
  2. HTML file names may be any combination of upper- and lower-case characters;
  3. To be accepted by all web servers, file names should not include spaces or any punctuation characters except "-" (hyphen), "_" (underscore) and "." (period -- also known in internet lingo as "dot");
  4. A special file known as the default file must be named index.html to work properly on many web servers. This is the file that becomes your Home Page; that is, it is the file that opens first when someone visits your Web Site (see Why your home page should be named "index.html").
  5. Examples
    1. Correct file names:
      • index.html
      • my_web_page.html
      • my_web_page.htm
      • SAMPLES.html
      • Some-Tasty-Morsels.html
    2. Incorrect file names:
      • index.html.txt -- with ".txt" it won't be shown as a web page
      • index.htm -- must have the "l" if this is meant to be the default  (home page) file
      • my web page.html -- won't be found on a web server because of spaces in the filename
      • destination:Nepal.html -- ":" and other punctuation not allowed in filenames

[Go to Top] [Return to Web Lab Home Page] [Ask Bruce]

Why your home page should be named "index.html"

Most web servers have a standard default file name, usually index.html, which they will open first when someone visits your web site. This is known as your "home page." For example, if

then your web address (i.e., your URL) will be:

http://www.brucevanallen.com/weblab/

Even though no file name was specified, a request for this address will automatically open the index.html file, hence its name, "Home Page."

If no file named "index.html" existed at this site, then a request for the above URL would usually get a listing of the site's files under the heading "Index of weblab." While this isn't necessarily bad, it won't look like a web site, which could confuse your visitors. Also, such a list might include files you don't want visitors to see: scripts, out-of-date pages, pages under construction, data files, etc.

Using your web server's default file name for your home page also keeps your site's URL shorter. For example, if you named your home page homepage.html, then your URL will be:

http://www.brucevanallen.com/weblab/homepage.html


[Go to Top] [Return to Web Lab Home Page] [Ask Bruce]