ptg16476052
632 LESSON 23: How to Publish Your Site
Keeping Your Files Organized with Directories
Probably the easiest way to organize your site is to include all the files in a single direc-
tory. If you have many extra files—images, for example—you can put them in a subdi-
rectory under that main directory. Your goal is to contain all your files in a single place
rather than scatter them around. You can then set all the links in those files to be relative
to that directory. This makes it easier to move the directory around to different servers
without breaking the links.
Having a Default Index File and Correct Filenames
Web servers usually have a default index file that’s loaded when a URL ends with a
directory name rather than a filename. One of the questions you should ask your web-
master is, “What’s the name of this default file?” For most web servers, this file is called
index.html. Your home page, or top-level index, for each site should have this name so
that the server knows which page to send as the default page. Each subdirectory should
also have a default file if it contains HTML files. If you use this default filename, the
URL to that page will be shorter because you don’t have to include the actual filename.
For example, your URL might be http://www.example.com/pages/ rather than http://
http://www.examplecom/pages/index.html.
If you don’t put an index file in a directory, many web servers will
enable people to browse the contents of the directory. If you don’t
want people to snoop around in your files, you should include an
index file or use the web server’s access controls to disable direc-
tory browsing. Ask your webmaster for help.
CAUTION
Also, each file should have an appropriate extension indicating its type so that the server
can map it to the appropriate file type. If you’ve been reading this book in sequential
order, all your files should have this special extension already and you shouldn’t have
any problems. Table 23.1 lists the common file extensions that you should be using for
your files and multimedia.
TABLE 23.1 Common File Types and Extensions
Format Extension
HTML .html, .htm
ASCII Text .txt
GIF .gif