Knowingly or unknowingly, every day, you make use of URLs to access a particular webpage. If you are someone who is continuously busy surfing the nooks and corners of the internet world, you must have at least heard the term URL.
So, what exactly is a URL? URL is an acronym for Universal Resource Locator. It acts as a reference or address of a resource on the web, more accurately, on the internet.
It can refer to the website, or some specific document, or an image. It can also point to other resources on the net, such as database queries and command output. The term web address or internet address is a synonym for a URL.
It has two main components which are separated by a colon (:) and two forward slashes (//), the protocol identifier, and the resource name.
The two common types of URL are Absolute and Relative URLs. Some portions of a URL are case sensitive, especially, everything after the domain name, i.e., the directories and file name.
You can locate the URL at the top of your browser window in the address bar. You can also manually enter a URL by typing it in the same address bar.
Now, let’s take a closer look and try to understand more about URLs.
What do you mean by URL?
If somebody wants to visit your house, what is the first thing they are going to ask you? Your guesswork is right; it’s the address.
Similarly, when you want to access a particular website/webpage, you require an address. That address is known as URL.
It is a formatted text string that a web browser, email clients, and other software use to identify the location of a resource on the Internet.
It is a specific form of Uniform Resource Identifier (URI).
Apart from accessing websites, URLs also help you to download or view a particular image, video, applications, etc.
It is merely a more technical term for a web address or a (web) link when it refers to URLs that use the HTTP or HTTPS protocol.
History of URL
In 1994, Tim Berners-Lee developed the Uniform Resource Locator (URL) along with the Internet Engineering Task Force (IETF) URI working group.
The objective was to take the idea of telephone numbers and employ them to address millions of web pages and machines.
RFC 1738 formally specifies the format of the URL.
How does a URL work?
A URL works by the given coded information that leads the browser to one specific place on the Internet.
A URL can consist of several different parts. Once you know about these parts, you can read a URL to collect information about a resource before you even view the page.
Let’s assume a URL to be a postal mail address.
In that case, the protocol represents the postal service you want to use to deliver the mail. You can think the domain name as the city or town, and the port is like the zip code. The path depicts the building where the postal service must deliver your mail.
The parameters indicate additional information such as the number of the apartment in the building. Finally, the reference represents the actual person to whom you’ve addressed your mail.
And the Domain Name System (DNS) operates in the background like a phone book, translating the more human-friendly hostnames into the IP addresses.
What are the main parts of a URL?
Keeping the postal mailing address analogy in mind, let’s discuss the structure of a URL in detail and how it works to get you where you want to go.
The URL https://www.stemjar.com/ is the address for our website. In the above example, HTTPS is the protocol identifier, and www.stemjar.com is the resource name.
The protocol identifier depicts the name of the protocol to be used to fetch the resource.
The above example uses HTTPS, which stands for Hypertext Transfer Protocol Secure. It is a more secure version of Hypertext Transfer Protocol (HTTP), which is typically used to serve up hypertext documents.
It is likely the only one most people encounter, but there are also other protocols, such as FTP, Telnet, mailto (emails), Gopher, News (Usenet), etc. Each protocol has a unique set of syntax rules to reach the destination
After the HTTP or HTTPS is the colon (:) and two forward slashes (//) that separate the protocol from the remaining URL.
The resource name indicates the complete address to the resource that you are searching. The protocol identifier determines the format of the resource name. It has several parts which you will see below.
In the above example, www refers to the World Wide Web. It is also commonly known as the web. The web is a collection of resources that you can access using the Internet.
It is not necessary for you to mention this portion in the URL. For example, typing “https://stemjar.com” would still get you to the StemJar web page. Just try once!
It indicates the hostname that helps in accessing a particular website. Each hostname has a corresponding IP address, which you do not see.
The DNS server first translates this hostname to its corresponding IP address to make access possible.
The hostname maps to an IP address of a specific resource on the internet.
This portion of the URL present after the last dot is known as the top-level domain (TLD). They serve as a way to understand what the website is about or what the location of the registrant is.
For example, .gov represents that the website is a government website, while .edu would indicate the website belongs to a educational organization. Some examples of top-level domains include .net, .org, .co.uk, .in, .info, .edu, etc.
The combination of the hostname and the top level domain is known as the Fully Qualified Domain Name (FQDN).
You can also refer to it as the absolute domain name as it gives the absolute path of the host.
Other Parts of a URL
Apart from the parts mentioned above, a URL may also include a filename, a port number or a reference.
The filename shows where the file resides on the host machine. You can view/write the filename after the domain name separated by single forward slash ‘/.’
It indicates the technical gate used to access the resources on the web server. Here, the default port used for communication is 443.
If a web server uses the default ports of the HTTP protocol (80 for HTTP and 443 for HTTPS), then it is not necessary to include the port number. Otherwise, it is mandatory.
For instance, you can open google.com by specifying its port number at the end like https://www.google.com:80, but it isn’t necessary.
If the website were operating on port 8080 instead, you could replace the port and access the page that way.
You can view/write the Port number after the TLD separated by a colon (:).
Reference is present in the URL when you want to get a direction to a specific part of the file. It is optional.
What are the different types of a URL?
Depending on the location of the document you want to link to, URLs vary accordingly. They typically fall into two categories; Absolute and Relative URL. Absolute URL
An absolute URL includes all the information necessary to find the files on the internet. It contains the protocol indicator, hostname, folder name and file name.
Absolute URL is similar to address used by the Postal Service, which includes, street address, apartment number, city, state and zip code.
If any information is missing, like the street number or apartment 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 have no idea about where and how to search for the file.
In the same way, if the folder or file name is absent, browsers won’t know which piece of information to pull off the server.
Generally, absolute URLs are long and hence many web developers do not prefer to use it.
A relative URL typically includes only the folder name and file name or even just the file name.
If the destination file, to which you want to link to and the originating file, are present in the same root directory, you are likely to use relative URL.
In such scenarios, a browser doesn’t need the server name or the protocol indicator. You can refer to it as a partial URL.
Suppose, you are going to make a local phone call within your city or state. When you make that call, it is not crucial for you to include the country code. You dial the local number. Your call will still connect.
Similarly, the server only needs the file or directory name, if it wants to link to local files on the same root directory.
Relative URLs are usually short as they are referring to root directory/subdirectory.
Is URL Case-sensitive?
An URL is only case sensitive for everything after the domain name. For instance, it does not matter whether you type “stemjar.com in uppercase or lowercase, you will still view the same webpage.
However, if you are typing the name of the page, file, or directory in the URL, it is case sensitive.
If you have no idea whether the page or directory is in uppercase or lowercase, then always use lowercase. Typically, most of the pages on the Internet are in all lowercase to make them more user-friendly.
What characters are not allowed in a URL?
Just like dialing a wrong number cannot connect your call, a single mistake in the URL will misguide your browser. It will then cause a ‘File not Found’ error.
Space is not allowed in any URL. Therefore, make sure that you do not use spaces while typing in an address.
However, you can use + (plus) sign to include spaces. Else, the browser automatically encodes the space to a value of %20 when entered through the address bar.
A URL can have only numbers, letters, and the following characters: ()!$-‘_*+.
Any other characters have to be encoded or, translated to programming code before including in a URL.
If your browser displays an error when you try to view a specific webpage, you can double-check the URL for typing mistakes or other errors.
If you find any error, then you can manually edit the URL and press Enter to see if it works.
To summarize, URL’s are nothing but a more generic term for computer addresses on the Internet. We all use URLs to visit web pages and other resources on the web.
It may seem to be complicated at first. However, once you get an idea of it, you will notice that URL’s are exactly like an international telephone number with a country code, area code, and the phone number itself.
It acts as an essential network identification for any resource connected to the web, for example, hypertext pages, images, and sound files.
It also helps you to find the same page over and over again. By creating a file of favorite URLs, i.e., bookmarks, you can quickly return to specific pages or resources.
Just take a quick glance at the address bar of your browser right now. It is displaying the URL of this article. So, now that you have reached the end of this article, why don’t you try to identify the parts yourself?