How to Name Files and Directories
Note that in this tutorial we are talking about file names (the name you give a file when you save the file), not the text in HTML titles.
Because you usually put your Web files on a Unix server; Unix file and directory (folder) naming conventions apply. This means that file and directory names can contain only the following:
- uppercase letters A-Z.
- lowercase letters a-z.
- numbers 0-9.
- a hyphen.
- an underscore.
- a dot (a period).
In other words, no other punctuation, no special characters, and NO SPACES. Let me say this again: NO SPACES in file or directory names. Additionally:
- file and directory names should not start with a dot.
- file and directory names are case-sensitive.
Home pages
Home page files are always named "index.html" (or, if the page uses PHP, it can be named "index.php"). The home page for your entire Web site is a file named "index.html" in your "public_html" directory. When you have a site with many pages, it is common to create directories within your public_html directory to better organize the information of your site. Usually each directory will also have a file named "index.html", which is the home page for those pages in that section of your site.
Note that "index.html" must be all lowercase.
File name extensions for Web pages
Web pages should always be named with the following extensions:
.html
.htm
.php
(for pages with PHP and PHP includes).shtml
(for pages with server side includes)
File name extensions for images
Image files should always be named with the following extensions:
.gif
(for GIF images).jpeg
(for JPEG images).jpg
(also used for JPEG images).png
(for PNG images)
File name extensions for cascading style sheets (CSS)
External style sheets should always be named with the following extension:
.css