Absolute Pathnames
An absolute pathname always starts from the root directory , which is indicated by a slash (/). So, for example, the pathname for the pers directory is /users/jen/pers, as shown in Figure 4-2. The first slash indicates that you are starting at the root and is necessary for indicating that a pathname is absolute.
![Example of a directory hierarchy](/api/v2/epubs/0596009879/files/httpatomoreillycomsourceoreillyimages110581.png)
Figure 4-1. Example of a directory hierarchy
![Visual representation of the path /users/jen/pers](/api/v2/epubs/0596009879/files/httpatomoreillycomsourceoreillyimages110583.png)
Figure 4-2. Visual representation of the path /users/jen/pers
The advantage to using absolute pathnames in links, image tags, and other places where you provide the URL of a file on the server is mobility. Because the pathname starts at the top of the server hierarchy, you can move the file to another directory on the server and the links won’t break. The downside is that it makes it more difficult to test pages on your local machine, because your machine is likely to have a different root directory than the final destination server.
Get Web Design in a Nutshell, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.