A rendering of two grey filing cabinets against a grey background

There are a few key rues for naming and organising files for web sites:

  • HTML pages should be saved with the .html extension. The vast majority of the time, the home page of your site will be named index.html in order to be picked up by the browser as the default document. (If you’re using , the filename will usually be index.php.)
  • Use alphanumerics only in page names. That is, a-z, 0-9. The only exceptions are: -(dash), _(underscore) and ~ (tilde).
  • Never use spaces in the file name of anything destined for the web, as spaces will be encoded by the server, producing long and ugly URLs. Replace spaces with hyphens.
  • Use lowercase exclusively when naming files, as some web servers are sensitive to case.
  • When planning a site, create a naming convention for files and stick to it without exception.
  • Always <title> a page the moment you create it, using a convention you have created. Too often this task falls by the wayside and is neglected, resulting in irrelevant or confusing titles, or no title at all.
  • Always remain aware where you are saving files, and be consistent about doing so. New web developers often experience a great deal of frustration and confusion due to the fact that they're looking at the wrong version of the file they think they are working on. For that reason, I strongly suggest saving only one copy of any file: do not try to retain multiple versions of the same page. If you start a new page, give it a completely different (and appropriate) file name.

Rendering by Jamie Durrant, licensed under Creative Commons.

Enjoy this piece? I invite you to follow me at twitter.com/dudleystorey to learn more.