Relative and Absolute Directories

All the directory paths we have been discussing up to now have been relative paths. They are written starting from the directory in which the file that the link is in, is saved. But you can also write a link as an absolute path, starting from the root level of the system. The root level is always designated by a forward slash (/) at the beginning of a directory path. So if you see:

<A HREF="/Hard Drive/HTML/HTML_file.html">some text</A>

you'll know it's an absolute reference to a file called HTML file in the folder HTML on the drive called Hard Drive on a Macintosh. The long file name with underslines, plus the use of the .html extension, are the clues. The link:

<A HREF="/d|/html/html.htm">some text</A>

refers to a file called html.htm in a directory called HTML on the D: drive of a DOS/Windows computer. The (|) is the give-away.

The advantage of writing relative links is that you can move a complete Web information site, with many links to files in many different directories, to another directory, disk, or computer, without losing the links between the files. You must reproduce the directory structure entirely and point the reader to the HTML file relative to which all the links are written. This file is called the Home Page for that Web information site.

If you had chosen to write absolute directory paths, you would have to change each and every link, if you more the information to another disk, directory or server. That can be very tedious!


[Back] Back to Linking Documents with HTML
[Up] Up to the Contents page