URL stands for Uniform Resource Locator. It is one of the basic building blocks of the Web.
URL address makes it possible for a browser to retrieve resources from a server.
A common example of a URL is a website URL, such as www.example.com. When you enter a URL into a URL bar, the browser gets the information behind the address and displays it as a website.
Here is the URL structure:
This guide teaches you all the basics of URLs.
You do not need a technical or coding background to follow this guide.
If you are just a curious learner this guide is for you. If you happen to be a website owner, such as a blogger, you will also benefit from the information in this guide.
Let’s start by taking a look at the different URL parts.
Understanding URL Parts
You have probably seen thousands of different-looking URLs in your life.
Some URLs are short and concise, whereas the others are unreadable and long.
But what makes up a URL? Even though you may have seen infinitely long URLs, they all consist of these 7 main parts:
- Domain Name
- File Path
- Query Parameters
Notice that not all URLs need to have all these parts in place.
For instance, you don’t usually specify the port, query parameters, or the fragment. But it’s still worthwhile understanding how all the URL parts work.
Let’s take a look at each URL part in-depth.
The protocol is the very first part of a URL. It is sometimes also called the scheme.
The URL protocol specifies a set of rules based on which a resource is:
The most popular protocol is the HTTP protocol.
HTTP stands for hypertext transfer protocol. This means that a page will be displayed in a hypertext format. Hypertext format refers to HTML, which is used to build websites. Hypertext as a concept means that in addition to text, the data consists of hypermedia, such as links or images.
These days, you do not see HTTP that much anymore.
Instead, you use HTTPS, which is a more secure version of the HTTP protocol. At the end of this guide, you are going to find a more in-depth explanation of the difference between HTTP and HTTPS.
As you might imagine, HTTP is not the only protocol that there is. Other popular protocols include:
- FTP or File Transfer Protocol. As the name suggests, this protocol can transfer files over the internet.
- SMTP or Single Mail Transfer Protocol. This protocol can be used for sending emails with mailing servers.
For example, an FTP URL might look something like this:
A subdomain is a part that comes before the actual domain name. The most common subdomain is the www subdomain. This basically means that the website is part of the world wide web.
The subdomain can also be something else than www. Usually, websites use subdomains to split their website into logical pieces.
Here the blog, store, and support are the subdomains of the example.com domain. As the names suggest, these subdomains split the website into logical groups based on content.
The domain name is the most memoizable part of a URL address. It is the name of the site. A domain name is used to communicate information about the website.
A domain can be further broken down to:
- The Domain Name, such as example in example.com
- The Top-Level Domain, such as .com in example.com
Each website has a unique domain. No two sites can have the same domain. The domain name acts as the unique address of a website.
Back in the day, the domain name was just an IP address, such as 241.152.131.208. But because this is hard to remember, a human-readable name is used instead.
But behind the scenes, the browser still uses an IP address to navigate to the website. This happens by using a DNS (Domain Name System). It translates a human-readable domain name to an IP address of the site. The browser uses this to look up the website using the IP address of the domain.
Now, let’s have a closer look at the Top-Level Domain part of the Domain.
Top-Level Domain (TLD)
The Top-Level Domain (TLD) is the “extension” in the domain name.
The most common TLDs are .com, .org, or .net.
Originally, the TLDs were used to express what the site is about. For example, a site with a TLD:
- .com means the content is commercial.
- .org refers to an organization site.
- .edu refers to an educational site.
- .gov refers to a government site.
These days the common TLDs, such as .com, .org, and .net can appear on any site without associations.
The TLDs can be split further into three categories:
- gTLD for Generic Top-Level Domains. For example, .com, .org, or .net. The gTLDs are the most common TLDs. These are used by websites across the globe. Anyone can get one of the gTLDs.
- sTLD for Sponsored Top-Level Domains. For example, .gov, .edu, .mil. Only verified sponsored organizations can use sTLDs.
- ccTLD for County Code Top-Level Domains. For example, .us, .uk, .eu. These ccTLDs target a specific country. You can recognize a ccTLD from two letters. Only a ccTLD can have two letters. All the other TLDs have more than two letters.
In case you are interested, here is a full list of all the possible TLDs there are.
The port of a URL is a “gate” via which the browser can access the resources on a server.
The reason why you don’t have to specify a port is that with HTTP protocols it is inserted automatically.
- HTTP automatically uses port 80.
- HTTPS automatically uses port 443.
But if the protocol is not HTTP or HTTPS, specifying the port is mandatory.
For example, if you use the FTP protocol to transfer files, you have to specify the port in the URL.
5. File Path
The URL path specifies from which directory you want to access files on a server.
But what files? A website is not a file, isn’t it?
When you use a URL to visit a website, you actually use a browser to get and show files from a remote server.
This server is no different than your local machine where your personal files live.
On your computer, you might have a file path like
On a web server, you could have a similar file structure.
Notice that these days, the URL path does not usually reflect the file structure on the webserver. Instead, the URL path identifies the navigation structure of the site. Thus, it is not common to see real file paths in a URL anymore.
6. Query Parameters
In addition to accessing a URL with an URL address, you can specify a query into the URL.
This performs an action on the server where the requested resources live.
A URL query is started by adding a question mark after a URL.
For example, on Youtube, you can share a video such that it starts from a specific time.
This is possible thanks to the URL query.
For example, here is a video that starts at 11 seconds:
Now take a look at the URL. At the end it says ?t=11. This is a simple query that the Youtube player uses to start the video at 11 seconds. Try to change the number to something else, e.g. 30.
The .be is a ccTLD that belongs to Belgium.
But the Youtube URL has nothing to do with Belgium. Youtube uses .be to make the shared links as short as possible. This makes them easier to fit in Tweets or other platforms with character limits. This is a clever trick by Youtube.
Another optional part of a URL address is the fragment. This is also commonly referred to as a URL anchor.
The URL fragment starts with a hashtag (#) and is followed by a word or words.
The fragment leads to a secondary resource on a URL.
For example, here is a URL with an anchor to a specific part of a blog post.
The fragment is commonly used to guide a user to a particular portion of a web page. When you click a URL with a fragment, the page scrolls to a specific part.
Amazing! Now you have a great understanding of what is a URL. From this point on, you are going to see URLs very differently.
Next, let’s take a closer look at HTTP and HTTPS protocols.
HTTP vs HTTPS
Back in the day, HTTP used to be the main protocol used when accessing websites.
However, these days, HTTPS has taken over.
Basically, HTTPS is a secure version of HTTP.
HTTPS uses SSL to encrypt the connection between the client and the server. Thus, it becomes harder for hackers to intercept the requests. Any website owner can change HTTP to HTTPS in a matter of minutes.
Thus, if you see a site that does not use HTTPS, chances are the site is not a quality page. When a website does not use HTTPS, you get a browser warning of an unsecured site.
If the website uses HTTPS, this problem is gone. Instead of a warning, there is a lock icon next to the URL.
Notice that the lock icon does not mean the site itself is safe to use. Instead, it means that the connection to the site is safe.
URL vs URI
This article has so far been all about URLs. But you may also have heard about URIs.
URI or Uniform Resource Identifier is the parent category of all URLs. A URI is a character sequence that separates one resource from another.
The subcategories of URI are:
- URL (Uniform Resource Locator). For instance, https://www.example.com.
- URN (Uniform Resource Number). For instance, urn:isbn:0-486-27557-4.
A real-life analogy to understanding the difference between URI and URL is as follows:
- A person’s name is like a URI. It identifies the person without sharing their location.
- A person’s address is like a URL. It identifies the physical location of a person.
Anyone who has used the internet has faced a situation where a page auto-redirects to another page.
For example, if you type a URL and land into another URL, you were redirected.
Redirecting is a commonly used technique that diverts visitors from one URL to another. A domain owner can very easily set up a redirect to forward traffic to any page on the internet.
But why redirect a page?
A common example is when the URL changes. Imagine you have a web page that gets a ton of traffic but you have to change its URL. To not lose all the traffic, you can redirect the visitors accessing the old URL to the new URL.
As an example:
- A website called example.com has a tutorial on how to create a song in example.com/song-tutorial-2022.
- When the year changes to 2023, the URL is no more accurate. Thus, they decide to change the URL to example.com/song-tutorial-2023.
- Now the problem is that anyone who tries to access example.com/song-tutorial-2022 will get an error.
- To fix this, the example.com owner redirects traffic from example.com/song-tutorial-2022 to example.com/song-tutorial-2023.
- If anyone tries to access the old page, they fly to the new page automatically.
Next, let’s talk about how URL shorteners work. Spoiler alert: They use redirects!
URL Shorteners: How Do They Work?
Have you ever seen a link like bit.ly/3kdd92jdkef that leads to some popular page, such as Amazon or Youtube?
This is an example of URL shortening.
It is a common technique that makes verbose and lengthy URLs shorter and more concise. For example, social platforms like Twitter have strict character limits. To place a link in a post, it has to be short.
But how does a URL shortener work?
A URL shortener works by redirecting traffic.
As you may recall, a domain can redirect traffic to any web page they like. A URL shortener is nothing but a regular domain dedicated to redirects.
Here is how it works:
- You have a URL shortening domain, like bitly.
- When you enter a URL to the tool, it creates a new bitly URL which redirects to the desired page.
- When your friend opens up the bitly URL, the redirect kicks in and leads to the right page.
What Is WWW?
WWW stands for World Wide Web. It is the system that connects all public websites accessible through the internet.
All the websites that are publicly available belong to the WWW.
Note that the web is not the same thing as the internet. The web is just one of the applications built on top of the internet.
The worldwide web has three integral parts:
- The HTTP protocol enables data transfer between clients and servers. In other words, a browser can access websites with the HTTP protocol.
- Each website has a unique resource locator (URL) via which it can be accessed.
- HTML or Hypertext Markup Language is a file format for building web pages. One of the crucial components of the web is the ability to link resources through hyperlinks.
Why Some Sites Don’t Have WWW?
A regular website looks something like this:
But you may have noticed that some URLs look like this instead:
In this URL, the www part is missing.
But it’s unclear as to why it exists in a URL. Unlike many people think, www does not belong to the HTTP protocol.
Instead, www is an example of a subdomain.
For example, if there is a domain example.com, it could have the subdomains like:
But the truth is you don’t actually need www in a URL. A website that does not use www works exactly like one that uses. A domain owner can easily get rid of www if they want to.
The only reasons why a website might still use www are:
- The domain host wants to host many services under the same domain (for example, app, mail, blog). In this case, keeping the main website under the www subdomain is consistent to make it live on the same level as the other services. (app.example.com, mail.example.com, blog.example.com, www.example.com)
- Using www has become a convention over time.
How Much Does a Domain Cost?
A domain generally costs $10 – $20 a year.
The price depends on the domain name registrar and the type of domain.
But as you can see, it is really not expensive.
For instance, if you want to purchase a domain for yourself, I suggest doing firstname + lastname + the TLD. For example bobjones.com.
This is great if you decide to build a portfolio, website, or blog one day.
A great place to buy a domain is from BlueHost.
What Is URL Phishing?
URL phishing is a common technique to lure a person to enter their credentials to a legitimate-looking scamming site.
Commonly, phishing is done via email.
The phisher sends a legitimate-looking message with a URL to a malicious site.
The problem is that it is hard to identify whether the site is a phishing site or not.
If you get a suspicious mail:
- Ignore the Display Name. The email display can show anything the sender wants it to. Instead of trusting the display name, look at the email address. This way you can ensure it really comes from a trusted domain.
- Verify the Domain. Phishing URLs are usually slightly misspelled. When a recipient quickly looks at the URL, they cannot tell it apart from a legitimate site. For example, examplesite.com may be replaced with something like examplessite.com. If the URL is misspelled, it is a good indication that the site is a phishing site.
- Check the Link. The best way to avoid being phished is not to click any link on an email. Instead, you should navigate to the site using Google. However, if you cannot avoid clicking, you should first check if the link is legitimate. For example, you can enter a suspicious link to a tool like phishtank.com to verify the link.
What Is a URL Slug?
A URL slug is the part of the URL after the last backslash.
For example, it can come right after the domain name, or it can come after the file path.
Here are some examples of URL slugs in bold:
What Is a URL Blacklist?
A URL blacklist is a list of unsafe URLs, IP Addresses, and domain names. These domains are removed from the search by the authorities.
Web users cannot access blacklisted URLs, not even by accident.
Today you learned how a URL works.
A URL or Uniform Resource Locator is a unique address that leads to resources over the internet.
Every website on the internet has a unique URL via which it can be accessed.
To open a webpage:
- You enter a URL address to the browser URL bar.
- The browser uses the address to request the files that make up the site.
URLs come in many shapes and forms. Some URLs are verbose and long whereas others are short and concise.
After all any URL consists of these 7 parts:
- Domain Name
- File Path
- Query Parameters
Thanks for reading!