banner
Welcome to HTML.co.uk, the number one resource for all news, information, and happenings regarding HTML.

Updates: HTML.co.uk has just been relaunched. Subscribe to our RSS Feed to stay on top of HTML news and techniques.
May
6th

Conventions for Filenames

Author: Editor | Files under HTML Basics, HTML Tutorials
Tags for this article: , , , ,

Most server computers in today’s internet have either a Unix or Unix led operating system. Unix distinguishes between upper- and lowercase in filenames. Anyone who produces their web project in a Windows environment, for example, can become bitterly disappointed when their locally functioning graphic references and links suddenly no longer work after being uploaded onto the server computer. One reason for such a case would be if the destination link is written in lowercase in the HTML file, while the Windows system has transferred the file names in uppercase.

In such a situation there is almost no other option, aside from renaming the files on the server computer using FTP commands, or to adjust the links and graphics references so that the referenced destinations are found correctly. If you work with a system where upper- or lowercases in the file name only make a graphical, not internal difference, such as Windows, then it is best to only produce document names in lowercase. It is also best to write everything in lowercase for links and graphics references.

Filenames in terms of Compatibility

If you are producing your web project solely for internet use, then you have to make sure the files will be accepted by the server computer. With modern Unix systems, as most web servers use them, filenames of up to 256 characters long are accepted. The “_” character is allowed as a special character, otherwise all special characters should be avoided. Question marks “?” and stars “*” should definitely be avoided, because these characters have a special meaning with nearly all systems.

File Endings

Here the general rule holds true: stick to the usual and standard file endings unconditionally. The web server must determine, based on the file ending, which MIME type it sends the browser. And the browser decides how to treat the file depending on the MIME type.

  • Typical HTML files either include the ending .htm or .html
  • HTML files containing server side endings possess the .shtml and .shtm endings
  • HTML files with PHP sections have the ending .php
  • While HTML files with ASP sections have the ending .asp

Default File Names with Web Servers

Most of today’s web servers see one or multiple file names as the file for the “Home site”. Most of the time the home page has the name index.html or index.htm, but sometimes it also uses welcome.html or welcome.htm or default.html or default.htm. Some providers allow you to choose your own filename as the default filename.

Default filenames have the advantage of making it so the web addresses becomes shorter, as they no longer require any other HTML file names. Many web addresses simply consist or http://www.example.org/ or http://www.example.org/directory/ – without any other information regarding a specific HTML file. A certain HTML file is nevertheless uploaded when loading the web address, because the filename is already saved by the web server as a default filename.

You may ask your provider if they offer default filenames for directories, and if so, then which. Construct your project in such a way that your home page has one of these filenames and that the subordinate pages refer back to it.