The difference between relative and absolute addresses can be explained using actual addresses. Consider the following addressing methods:
Absolute Address: 221B Baker St. London, England
Relative Address: 4 Blocks North, 3 Blocks East, Last House on the Right
As you can see, the relative address is relative to where you are. If you move, the directions become incorrect. Whereas the absolute address is always correct. Ok, but how does this apply to websites?
Websites, like your files at home, are organized into folders. When you access a url like this:
You are accessing the file about.html in the folder en which is in the folder intl which is in the so-called root of the webserver. The url above is an absolute url. It is the full address of the file. If you look at the code for this page, (we’ll talk about how to do that later) you will see links like this:
<a href="contact/index.html">Contact Us</a>
So if about.html contains this relative link, then the link is pointing at the file index.html in the folder contact which is in the same folder as about.html. If we were to convert this link into an absolute address it would look like this:
<a href="http://www.google.com/intl/en/contact/index.html">Contact Us</a>
They both resolve to the same place, except one uses a full address, and one uses directions on how to get there.
One more thing before we wrap up addressing. When you point a browser at a folder instead of a file, you will be given the default file for that folder. Generally, that file is index.html. So using the link above as an example, if you access this url:
The server will give you the index.html inside it be default. Next up, we will make a real live website.