Explanation of relative, absolute, network and web paths
March 10, 2007
Web Building
Paths can be one of the most confusing aspects of web development. Most web designers are familar with absolute paths and relative paths:

Absolute paths point to files that can be anywhere on the internet. They don't assume any relative location to the current document. An absolute path to a file will always be the same, no matter where the link to it is located.

Example of an absolute path:


Ads by Google

Posted by ellen at March 10, 2007 10:04 AM

Relative paths("document-relative"), point to files that are on the same server, and where the location with respect will always be the same.

Example of a relative path:



Example of a relative path that points to the parent of the current directory, then down two directories.


"../" means "move up one directory from the current one."

so "../../" means "move up two directories from the current one."

So, if the current page is located at
and you add a link to the current page like:
<a href="directory3/directory4/filename.htm">Link</a>
your link is actually pointing to:
and, if you use the dot-dot-slash notation:
<a href="../directory3/directory4/otherfile.htm">Link</a>
your link points to


Relative to web root:
What if you want to use the same navigation bar all throughout your site, and your files could be located at different depths away from the web root? You can use this notation:


Beginning the path with a slash means this path is relative to the web root.

This means no matter where the current page is located on the site, no matter how many folders deep,

and you add a link to the current page like:


your link is pointing to


What if you see a link like:

C:\Documents and Settings\yourname\Desktop\otherfile.htm

This is a local filesystem path which is ONLY USABLE on one computer. The "C:" refers to a hard drive, and the backward pointing slashes are an indicator that this is a filesystem path, NOT a web path. In other words, it points downward into your computer or server, not outward to the web. These types of paths are often used by mistake by newcomers to Dreamweaver who link to local files without realizing it. However they are also used by server-side scripting languages like ASP and PHP when referring to files within the filesystem. If you use a local filesystem path in your webpages, assuming it points to a file that exists on the server, Internet Explorer will accept it, but other browsers will not.

How about a link like:


This is a network filesystem path, referring to a directory on a server on the network.

You may also come across paths like this particularly in ASP scripts:
"." or "/"
means simply "the current directory"
means "the web root"
means the parent directory

Ads by Google

Ads by Google

 RSS   |   Contact Me

Ads by Google