Absolute vs. Relative URL

Here's the difference between a Relative and an Absolute URL.

An Absolute URL is one that works from no matter where you try to use it.

For example,
http://www.cs.rice.edu/CRPC/GT/silha/Lessons.html is an absolute URL.

The absolute URL show the entire path to the file, including the protocol, server name, the complete path and the file name itself.

In our HTML book by Elizabeth Castro on page 20 she explains it this way:

An absolute URL is analogous to a complete street address, including name, street and number, city, state, zip code, and country. No matter where a letter is sent from, the post office will be able to find the recipient.

A Relative URL, on the other hand, depends on being accessed from some particular place. Again, in the HTML book on pg. 21 she explains it this way...

To give you directions to my neighbor's house, instead of giving her complete address, I might just say "it's three doors down on the right". This is a relative address -- where it points to depends on where the information is given from. With the same information in a different city, you'd never find my neighbor.

For example,

the URL Images/ will work from the page at http://www.cs.rice.edu/CRPC/GT/silha/

Why does this matter?

Suppose my home page contains a link to my Images directory. If my home page's new URL becomes http://www.crpc.rice.edu/CRPC/GT/silha/ then the absolute URL will still point to http://www.crpc.rice.edu/CRPC/GT/silha/ while the relative URL is RELATIVE to where my new home page is, so it will get the pictures out of http://www.crpc.rice.edu/CRPC/GT/silha/Images which is what I'd want if all my stuff got moved over.

So, here's what you need to do. For every anchor that you have on every page, check what the reference ("HREF") reads. Suppose it looks like

< A HREF="http://www.crpc.rice.edu/CRPC/GT/silha/Images">fish </A>

then you should change it to look like

< A HREF="Images/">fish </A>

Let's take a look at the document source of an example page.

Click Example

Back to Schedule

This page was developed through GirlTECH '97, a teacher training and student technology council program sponsored by the Center for Research on Parallel Computation (CRPC), a National Science Foundation-funded Science and Technology Center. Thanks to the RGK Foundation for its generous support.