Originally posted by vijay shanker:
When you're creating links to documents and images on the Web, you need to think about how you're going to link to them. There are two standard ways to create links:
* absolute paths
* relative paths
Absolute paths are called that because they refer to the very specific location, including the domain name. The absolute path to a Web element is also often referred to as the URL. For example, the absolute path to this Web page is: http:/abc.com/home/room/bed.htm
Relative paths change depending upon what page the links are located on. There are several rules to creating a link using the relative path:
* links in the same directory as the page have no path information listed
filename
* sub-directories are listed without any preceding slashes
weekly/filename
* links up one directory are listed as
../filename
How to determine the relative path:
1. Determine the location of the page you are editing.
This article is located in the/library/weekly folder on my site.
2. Determine the location of the page or image you want to link to.
The Beginner's Resource Center is located here: /library/beginning/
3. Compare the locations and to decide how to point to it
From this article, I would need to step up one directory (to/library) and then go back down to the beginning directory
4. Write the link using the rules listed above:
<a href="../beginning/bl_begin.htm"> ...</a>
One last note before closing this (see link to duplicate
thread above).
Vijay's explanation of relative and absolute URLs in HTTP settings is good but it leaves out an important aspect of server side
Java applications called the contextPath. With servlet and JSP apps, it is better to use the approach in our JSP faq when building URLs.
[ March 17, 2008: Message edited by: Ben Souther ]