ARCHIVED: What is the difference between an absolute and a relative URL?
An absolute URL contains more information than a relative URL does. Relative URLs are more convenient because they are shorter and often more portable. However, you can use them only to reference links on the same server as the page that contains them.
Linking with absolute URLs
An absolute URL typically takes the following form:
protocol is usually
http://, but can
domain is the name of the
website. For example, the domain name of Indiana University's central
web server is
path includes directory and file
information. You must use absolute URLs when referring to links on
Linking with relative URLs
Relative URLs can take a number of different forms. When referring
to a file that occurs in the same directory as the referring page, a
URL can be as simple as the name of the file. For example, if you want
to create a link in your home page to the file
foobar.html, which is in the same directory as your home
page, you would use:
<a href="foobar.html">The Wonderful World of Foobar!</a>
If the file you want to link to is in a subdirectory of the referring
page's directory, you need to enter only the directory information and
the name of the file. So if
foobar.html were in the
foobar subdirectory of your
you could refer to it from your home page by using:
<a href="foobar/foobar.html">The Wonderful World of Foobar!</a>
If the file you want to link to is in a higher directory than the
referring page, use
.., which means to go up
a directory. For example, to link from
home.html, which is in the directory above, you would
<a href="../home.html">Go back to my home page</a>
This is document abwp in the Knowledge Base.
Last modified on 2014-12-18 00:00:00.
- Fill out this form to submit your issue to the UITS Support Center.
- Please note that you must be affiliated with Indiana University to receive support.
- All fields are required.