6.2 Linking within websites

When linking to the pages of your own website the full URL doesn't need to be given. For example, if two web pages are saved in the same folder on a PC, or on your web hosting provider's server, a link can be made from one page to another by simply entering the filename in the link. For example:

<a href="page2.html">Page 2</a>

This is actually exactly the same as the first example given in the section on links. Now, if page 2 were placed in a subfolder, then we would have to include the folder name:

<a href="subfolder/page2.html">Page 2</a>

And if we wanted to link from page 2 in the subfolder back to page 1:

<a href="../page1.html">A link to page 1</a>

../ is the standard format for pointing to a folder one level up from where the link is made. Two folders can be traversed using "../../" and so on, or alternatively the full URL can be used.