A Uniform Resource Locator (URL) is the address used to specify the location of a webpage on a web server, and the communication protocol that should be used to render the webpage in a web browser.
A typical URL includes three critical pieces of information:
- The communication protocol that should be used to access the webpage.
- The domain name where the webpage resides.
- The path to the resource, or page, that should rendered in the browser.
For most webpages, the protocol is HTTP, or HTTPS in the case of webpages that deal with potentially sensitive information. The domain name is typically similar to the name of the website. In the case of this website, Learn the Net, the domain name is learnthenet.com.
Following the domain name you may see a folder path that looks something like this http://example.com/path/file.html. In the example, the file rendered is file.html, and it is found in the folder called /path/. Not all webpages are configured so that a complete path is displayed, and if you are visiting a website homepage it is likely that the URL will not include a path.
The protocol, hostname, and path in combination form the URL of the webpage.
Frequently Asked Questions
What is the difference between a URI and a URL?
URI is an acronym that stands for Uniform Resource Identifier and is often used interchangeably with URL. However, technically speaking, the terms URL and URI are closely related, but not completely synonymous.
URLs are a type of URI. In order to qualify as a URL, a web address must include both the location (example.com) of the web page and the protocol (http://) used to access the web page. When web addresses are expressed without the protocol then technically they are not URLs but are URIs. There are additional details that apply to URIs that we don't need to cover here. The basic idea is that if you simply refer to google.com then you have referred to a URI, but if you refer to http://google.com then you have referred to a URL.
In practical application, you can use either URI or URL and everyone will know what you're talking about. Using the terms correctly is only critical in technical specifications.
Why do some URLs include a file extension while others don't?
You may have noticed that some URLs include a file extension like this http://example.com/page_name.html, while other don't, like this http://example.com/page_name. The reason has to do with software that powers the website. Some website frameworks, such as WordPress, are configured to generate and load webpages without using file extensions. However, some website frameworks still do generate file extensions.
Best practice is to avoid the use of file extensions in URLs if possible because subsequent versions of the website may require that you drop the file extension. The W3C has even addressed the issue in a style guide proclaiming that “cool URIs don't change”.