The full URL specifies everything about the requested file. This is an absolute
URL. If the requested file is on the same web server, an abbreviated form known as a relative
URL can be used. This is particularly useful for creating links and loading images. There
are several possible forms for relative URLs, depending on how close the requested page is
to the current page.
- If the requested file is in the highest-level folder for this web server, only a
"/" is necessary, followed by the filename if it is not the default filename
- If the requested page is in the same folder, only the name need be given.
- If the requested page is in a sub-folder, only the folder path from the folder for the
current page, and the file name (if it is not the default file name) need be given. In
this case, do not preceed the first folder with "/" - that is interpreted as the
highest level folder for this web server
NOTE: Relative URLs are very convenient, because if you develop the web site on one
computer and the web server is another computer, then you do not have to worry about the
higher-level folders on the web server, which the web master will often be reluctant to
divulge (the folder structure is one element needed to hack a web site). Also, if web
sites are moved, absolute URLs for the same web site are broken, while relative ones
usually survive.