by Larisa Thomason,
Senior Web Analyst,
Or perhaps a better question would be this: "what should - and should not - be in a file name?" The file names you choose have important ramifications for operating system compatibility, usability, and Web site promotion.
Select A File Naming Convention
It's important to select a file naming convention for your directories, HTML files, and image files - and stick to it. We use the term "convention" in reference to the list of "rules" you follow when naming your files. You're less likely to get broken links caused by simple typographical errors if you stick to your naming rules.
But before you write your own file naming rules, you need to understand existing rules that different operating systems already follow.
Directory and file names are capital letter sensitive in UNIX and Macintosh systems. Those systems assume that these two URLs are completely different files:
Note that in the first URL, the filename contains capital letters and in the second URL, the file is all lower-case.
Many Web professionals recommend that you use only lower-case letters in file names.
- Less chance of coding errors because you don't have to remember what to capitalize and when.
- Visitors have an easier time if they're trying to type the URL directly into their browsers instead of clicking on a link.
An all lower-case format reduces errors, but also makes file names harder to read. As a compromise, designers use the underscore symbol (_) or a hyphen (-) to separate individual words in a file name:
Remember that your top-level domain name (MarsupialWorld.com in this example) is NOT capital letter sensitive. You're free to use any mixture of capital and lower-case letters to make the name more readable and memorable.
Naming Your Files
Readable and memorable are attributes you want with the actual file names too!
Your home page should always be named "index," but you have much more freedom with other pages. Try to make your file names descriptive and use targeted keywords whenever possible. That's how our fictional online business MarsupialWorld.com selects both directory and file names.
For instance, at MarsupialWorld.com, each major marsupial category has its own directory. This structure makes the site easier to maintain and increases keyword visibility for each category:
Each directory has a page dedicated to facts about the particular marsupial and other individual pages that highlight merchandise for sale. Some files in the kangaroo directory might have names like this:
In each page, the targeted keywords and keyword phrases are slightly different and the file name clearly describes each page's content.
Remember that search engines are now more apt to do a deep crawl on a Web site and index many internal pages. That gives you the opportunity to target different keywords and keyword phrases and optimize individual pages for those search terms. It's like having a brick and mortar store with 10 different entrances instead of just one.
But it's dangerous to assume that the spider will index all your internal pages. Deep submit your pages to selected search engines using Search Engine Power Pack's deep submit option. It helps you easily submit any page of your site, not just your home page.
Don't Hit The Space Bar
Never, ever use spaces in file and directory names! Windows operating systems do allow spaces and even seem to encourage you to use them, but UNIX operating systems (which run most servers) have problems with them.
Consider how different operating systems handle this URL:
http://www.MarsupialWorld.com/kangaroos/movies with kangaroos.html
A Windows system displays the file named "movies with kangaroos.html" with no trouble. You won't have any problem when you test your page on your own Windows or Macintosh operating system, but problems may arise when you place the page on a Web server running UNIX or Linux (which most do!).
The Web server interprets the space as a "%20" character and looks for a file named:
Will your visitors see the kangaroo movies page - or get the "page cannot be found" error message?
Spaces in file names just aren't worth the risk because they greatly increase the chance of errors:
- Site visitors get broken links with error messages instead of your content.
- You may inadvertently create broken links yourself when you try to change or correct your file names. Each time you change a file name you have to update the link on every page that links to the file you changed.
Find broken links before your visitors do. Use HTML Toolbox's Link Check feature each time you change a file name.
- Link popularity may suffer because external links pointing to the page won't work when you change the file name.
Be safe and avoid errors by never using spaces in your file names!
File Names And Site Promotion
Search engine spiders look at file names too:
- Keywords and key phrases: you get a boost when the file name contains the search terms you've targeted for the page.
- Individual words: some spiders can't distinguish individual words when a file name is one long word. So the file name "moviesaboutkangaroos.html" seems like gibberish to the spider. When you add underscores or hyphens to separate the words, the spider interprets the file name to contain the search phrase "movies about kangaroos."
Search Engine Power Pack's Page Primer tool gives you more engine-specific ways to optimize your Web pages for particular search engine algorithms. Page content is critically important to promoting your site to humans and search engines, but good, descriptive file names give you a boost as well.
It's a good, basic design technique that also helps you promote your site.