A url is the internet address of a webpage. Here are the examples we'll use in this tutorial:
The examples above are called "absolute" urls, because they contain the complete address of the webpage.
On the "My Home" page in Directory 1, you want to put a link to "My Garden" page in Directory 2. You could use the absolute (complete) url like this:
<a href="http://yourdomain.com/directory2/mygarden.html">"My Garden"</a>
But this requires the visitor's browser to go back out of your "My Home" page and your file manager to the internet, and then back into your file manager to get the "My Garden" page.
To make the "My Garden" page load faster, you can remove the domain part of the absolute url: http://yourdomain.com, and just use the rest of the url:
<a href="/directory2/mygarden.html">"My Garden"</a>
Note: You must include a slash (/) before the directory2 in the url. Some host servers may require two dots before the slash before the directory name:
<a href="../directory2/mygarden.html">"My Garden"</a>
If you have another page in Directory 1 that you want to link to on your "My Home" page, the relative url is even shorter, because you won't need to use the directory name:
<a href="myhome2.html">"My Home," page 2</a>
If you start using relative urls to make the links on your pages, you will save on the file size of each page, too.
Visit these other Tutorials by Flo
Friday 17th of August 2018 05:16:34 PM
by Tone By Tone Dot Net