Web Design

(Nancy Kaufman) #1

34


Understanding URLs and File Paths


Y


our Web site is a collection of linked pages. You can have links on your pages that take your user
to other pages in your site, other sites on the Web, other places within the same document, or

e-mail addresses. The details of creating each of these links are covered in the following sections,


but before you can start understanding the HTML syntax for links, you need to understand how to


reference other pages in your document and other sites on the Web.


Relative Paths
Pages within your site can be referenced from
one another via a relative path, where you tell
the browser where the page to which you are
linking is in relation to the current page. Think of
this like giving directions to someone on the
street, where you tell them how to go based on
your current location.

Pages in Folders
When providing a relative path, you may have files to
which you are linking that are in folders other than
the one that contains the file with the link. If the
page to which you are linking is in a folder, and that
folder is in the same folder as the page with the link,
you simply provide the folder name, a slash, and the
filename, as in products/widget.html.

Absolute Paths
Hyperlinks to other sites on the Web need to use
absolute paths for reference. Absolute paths contain the
complete address to the site, including http://. Using
an absolute path is similar to how you address a letter
in the mail: You provide the complete address,
regardless of where the letter originates.

http://www.example.com
Free download pdf