URL (Uniform Resource Locator):
URL stands for Uniform Resource Locator, which is simply an address of a document on the web, more accurately, on the internet. Although a URL can look complex and long, it’s made up of four basic parts – protocols, host names, folder names and file name – each of which has a specific function. Depending on the application, a URL can include additional information, to specify user names or input to a server-side script, but fundamentally these four parts cover the basics.
Types of URL:URLs vary depending on the location of the document to which user will link. Basically, URLs fall into two categories; Absolute and relative URL. They are described below.
(i) Absolute URL:
An absolute URL contains all the information necessary to find the files on the internet. It contains the protocol indicator, hostname, folder name and file name. Absolute URL are similar to address used by the U.S. Postal Service, which include a name, street address, apartment number, city, state and zip code. If some of the information is missing ― say, the street number or house number ― the carrier can’t deliver the mail to the right person.
Similarly, if the protocol indicator or hostname is missing from a URL, browsers can not link to a specific file because they wont know where and how to look for the file. Likewise, if the folder or file name is missing, browsers won’t know which piece of information to pull of the server. The given is an example of absolute URLs
(ii) Relative URLs :A relative URL usually contains only the folder name and file name or even just the file name. We can use these partial URLs when we are pointing to a file that’s located within the same folder or on the same server as the originating file. In these cases, a browser doesn’t need the server name or the protocol indicator because it assumes the files are located in a folder or on a server that’s relative to the originating document.
User can use relative URLs to refer to documents in relation to the originating documents, which is called Document-Relative URLs or to the server on which the originating document resides, which is called Server-Related URLs.
From the given figure, when linking from index.html, we use the following URLs,