In website developing, we must have a page and it is connected to the other pages. Now we will learn about how to connect a page to the others.
Now, download the new learning page by clicking
THIS LINK, you will receive RAR file which must be extracted by winRAR or winZIP.
If you have done download and extract them to be a folder, you can see 3 files named mainpage.html, page1.html, and page2.html . Open the mainpage.html and you can click those links which available on the page.
You know that those page are connected to each other, if you want to know how to do that, you can rename them to mainpage.txt, page1.txt, and page2.txt . Then you can open those page on the Notepad.
Let's take the mainpage.txt as example. Open it from Notepad.
You can see these script:
<html>
<body>
<h1>Welcome to the Page</h1>
<p>Learning from <a href="http://www.vektanova.com">Vektanova.com</a> .</p>
<p>These are link to the another page.
<p><a href="page1.html">Click here to go to Page 1</a></p>
<p><a href="page2.html">Click here to go to Page 2</a></p>
</body>
</html>
That file has 3 links, which a link is an external link to www.vektanova.com and two links are internal links to Page 1 and Page 2.
To write external link, you may write standard link code with <a> tag.
<p>Learning from <a href="http://www.vektanova.com">Vektanova.com</a> .</p>
But, to write internal link which connects to the other page in the same website, you need to write unique <a> tag.
<p><a href="page1.html">Click here to go to Page 1</a></p>
<p><a href="page2.html">Click here to go to Page 2</a></p>
Can see the different between writting external and internal links?
Why is it only <a href="page1.html"> ????
Why is it not <a href="http://www.website.com/page1.html"> ???
We wrote <a href="page1.html"> without http:///www on it because the another page that connected to the main page are in the same directory (we call it 'directory' as folder in the server, or we can say folder which is stored in a server is best called 'directory'). So we don't need to write http://www inside it.
If we store those pages into a server and has domain www.mywebsite.com, actually we can use <a href="http://www.mywebsite.com/page1.html"> to connect to other pages, but it will be better if we use only <a href="page1.html"> if those pages are in the same directory.
If as example we have page3.html as Page 3 in another directory called "New_Directory", we can use link <a href="/New_Directory/page3.html"> for the recommended way. Or we can write it with <a href="http://www.mywebsite.com/New_Directory/page3.html">.