What is a URL – Understanding the Basics

Are you setting up a new site but confused about URLs and what they are?

Perhaps you’re unsure how domain names relate to URLs. Maybe you’re wondering how permalinks differ from URLs or what anchor links are.

If so, you’ve come to the right place.

URLs are a key part of any website, so it’s vital that you have a good understanding of what they are and how they work. 

As there are different types of URLs, as well as different ways of using them, it’s worth spending a bit of time getting familiar with the topic and how it affects site owners. 

In this article, we explore exactly what a URL is. We cover the parts that make up a URL, look at the difference between absolute and relative URLs, and more. 

By the time you’ve finished reading, you’ll know how URLs work and how to use them effectively on your WordPress website. 

What is a URL? — A Quick Overview

Uniform Resource Locators, or URLs for short, are used by browsers to retrieve anything published on or uploaded to the web. Examples of items that have URLs include websites, individual website pages, and any files, such as images or documents they might contain. 

Anything uploaded to the internet can have a URL, whether it’s part of a website or not. 

In short, URLs can be considered the unique address of a website, file, or piece of content on the internet. 

When a URL is entered into a browser’s address bar, the browser will attempt to display or access whatever content that address or URL corresponds to. 

For example, the URL or address of this website is “https://wordpress.com,” and the URL of one of the ndividual pages on this site is “https://wordpress.com/go/tutorials/what-is-a-domain-name/.” 

If you enter those URLs into your browser’s address bar — either by clicking a link or typing in the URL yourself — the browser will (try to) display that website or webpage. 

There’s much more to URLs, though. In this guide, we’ll answer the question “what is a URL?” by covering the different parts of a URL, the differences between absolute and relative URLs, what characters are and aren’t allowed in URLs, and more. 

Parts of a URL

To get started, it’s important to understand the different parts of a URL. 

Protocol 

The first part of a URL is the protocol; two common examples are HTTP and HTTPS. We cover what HTTP and HTTPS protocols are and how they differ later on in this guide. 

To summarize, though, the protocol is a set of rules that define how data is transmitted over the internet, particularly between a web browser and the server the website resides on. 

Domain Name

The next part of the URL is the domain name. Domain names, such as google.com and bbc.co.uk, are the unique names that identify websites. 

They usually consist of at least two parts — the second-level domain (e.g., Google) and the top-level domain (e.g., com). Dots separate these parts. Some domain names include “www,” while others don’t. When setting up a domain name and website,  you can decide whether or not “www” is included and required.

You can use our domain name search tool if you need to find and register a great one for your site. 

Path

Entering the domain name, such as “google.com,” into the address or URL bar of a browser will usually take you to the homepage of the site associated with that domain name. 

However, each page and file that makes up a site will also have its own URL. 

For example, the contact page of a site might be “https://mywebsite.com/contact.html,” while an image used on the site might have the URL “https://mywebsite.com/images/logo.jpg.” 

In the second example, the image file (“logo.jpg”) is in the images directory (/images/) or folder on the server. 

Subdomains

Some URLs include a subdomain, which comes after the protocol and before the domain name. 

For example, in the URL “https://mail.google.com,” “mail” is the subdomain. One use for subdomains is to create separate websites that are part of the same domain name. 

However, the most commonly used subdomain is “www” (Word Wide Web), which is often used to direct traffic to the main website of a domain name, such as “google.com.” 

The “www” subdomain was also used to signify to people that the domain name was related to a website. However, as URLs and domain names now become much more common, there is less need to use “www” to signify that the domain name or URL is a web address that should be entered into a browser. When people see a domain name now, they tend to automatically recognize that it’s a website address, even if it doesn’t include the “www” subdomain. 

Absolute URLs vs. Relative URLs

Another aspect of URLs to consider is absolute and relative URLs. 

Absolute URLs include the full URL or address of the site, page, or other resource types, such as an image. 

For example, if you’re linking to a specific page on a website, the absolute URL might be “https://mywebsite.com/contact.html.”

Or, if you’re linking to or referencing a specific file on a site, such as an image, the absolute URL could be “https://mywebsite.com/images/logo.jpg.”

As you can see, an absolute URL includes everything, from the protocol (e.g., HTTP or HTTPS) to the domain name and, if relevant, the directory structure or path, filename, and anything else that’s required. 

Unlike absolute URLs, relative URLs only include part of the address, usually leaving out the protocol and domain parts of the absolute URL. They’re called relative URLs because they’re relative to the current page being viewed. 

For example, the relative URL to the image file in the earlier example might be “images/logo.jpg.”

Alternatively, it could just be “logo.jpg.”

The parts that have been left out (protocol, domain, and path) are assumed to be the same as the absolute URL of the page being linked from. 

So if an image file (“logo.jpg”) was being linked to from a page with the absolute URL “https://mywebsite.com/images/page.html,” part of the URL would be assumed and added to the beginning of the relative URL to become “https://mywebsite.com/images/logo.jpg.”

As the missing parts of the relative URL are taken from the page the relative URL has been used on, relative URLs are only used when linking to other pages and locations on the same site or domain. You wouldn’t try to link to a page or resource on another site or domain by using a relative URL — only an absolute URL. 

One benefit of using relative URLs over absolute URLS is that they’re faster to type. 

Another benefit is that if you change the domain name of your site or transfer a site from a testing server to a live server, you won’t have to worry about changing the URLs of any internal links you’ve used on your site to make sure they include the new domain. 

WordPress doesn’t use absolute URLs by default. Due to this, it’s not something you need to worry about if you’re building your site with this CMS. 

HTTP vs. HTTPS

As mentioned, the first part of a URL is the protocol, with the most common options for websites being HTTP and HTTPS.

HTTP stands for Hypertext Transfer Protocol, with the S standing for secure. 

The protocol defines how requests and responses are sent between computers and servers. This means that when you type a URL into a browser or click on a link, the protocol is used to send the request to view that website to the server. The server will then respond by displaying the desired website in your browser. 

The main difference between HTTP and HTTPS is that with HTTPS, the requests are encrypted rather than sent in plain text. 

The benefit of this is that it’s much harder for hackers or other bad actors to intercept the communication between your computer and the server hosting the website. This is particularly important if you’re sending sensitive data through a website, such as payment details or a message via a contact form. 

You can determine if a site you’re visiting uses HTTP or HTTPS by checking the address bar to see the full URL. Most web browsers will also display an icon near the address bar to give you a visual indication of whether a site is using HTTPS or not. 

To ensure that your site uses HTTPS rather than HTTP, you’ll need an SSL certificate. The process of getting and enabling an SSL certificate varies, depending on your preferences and choice of web host. However, all sites hosted by WordPress.com use HTTPS by default, so you don’t have to worry about acquiring an SSL certificate and then configuring it for your site when using our service. 

What Characters Are Not Allowed in a URL?

As you might’ve noticed, URLs are composed of numbers and letters. They can also include a few special characters, such as  “-,” “.,” “_,” and “~.”

International characters, including those from languages including Chinese and Japanese, can also be included in URLs, thanks to the Internationalized Resource Identifier (IRI) protocol.

However, there are also reserved characters that can be found in URLs but are used for specific purposes. This means they can’t be part of a domain name or typical URL unless they’re serving a specific purpose. Some examples of these are the “?,” “/,” and “#” characters (more on these later).

Characters that are not allowed at all are known as unsafe characters. Some examples of these include “space,” “\,” “<,” and “>.”

Parameters & Anchors

When working with URLS, you might have come across parameters and anchors. But what are they?

Parameters are used to pass information between web pages. This could be the term you’ve entered into a search engine like Google. 

The parameters are usually added to the end of a URL and are separated using a question mark (“?”).

For example, if you search Google for “WordPress,” you might see a URL that uses the “q” parameter to pass the WordPress keyword or search term:

https://www.google.com/search?q=wordpress

If multiple parameters are being sent, they’re separated using the ampersand (&) symbol. 

Anchors are also added to URLs, usually at the end. They’re separated from the main URL using the hash symbol (“#”).

Anchor links — or jump links as they’re sometimes known — let you link to specific parts of a page. For example, the anchor in the URL ”https://wordpress.com/go/digital-marketing/wordpress-payment-plugins/#1-woocommerce” takes you to the WooCommerce section of the page. 

Anchor links are perfect for creating interactive tables of contents that let readers quickly jump to different parts of a web page. 

Creating anchor links is relatively straightforward, and they’re an effective way to improve user experience by helping visitors quickly reach the section of the page they’re most interested in. 

Once you start using WordPress, it probably won’t take you long to come across permalinks. 

These permanent links, or permalinks for short, are URLs that WordPress uses to link to specific pieces of content on your site, such as its pages and blog posts. 

Each piece of content on a WordPress site has its own permalink, which, when accessed, takes the user to that piece of content. 

While they might sound the same as URLs, permalinks are different. Even when the location of the file or page is linked to changes, the permalink remains the same and still takes the user to that file or page. 

Another way that permalinks differ from URLs is that when using WordPress, you can create your own permalink structure. 

This custom structure could include words that make the URLs more descriptive. 

For example, the URLs of all of your blog posts could start with “https://mywebsite.com/blog/.” Or, if you’re running an eCommerce store, all of your product pages could start with the URL “https://mywebsite.com/shop/” or “https://mywebsite.com/products/.” 

You can also change the permalink of the page or blog post, such as “https://mywebsite.com/blog/guide-to-permalinks” instead of simply using the default name, which might be “https://mynewsite.com/blog/page1.”

The benefit of doing this is that using meaningful words in your permalinks makes it easier for visitors and search engines to quickly get an idea of what type of content they’re viewing on your site. 

Conclusion

You should now have a good understanding of URLs and how they’re used in relation to your website. 

From learning what parts make up a URL and the differences between absolute and relative URLs to understanding what characters aren’t allowed in URLs and how parameters and anchors work, you should be able to confidently use these terms when thinking about your website. If you choose to create your site with the WordPress website builder, some of the issues surrounding domains, such as making sure you’re using the HTTPS protocol, getting your relative links correct, and working with permalinks, will be greatly simplified.


Want more tips? Get new post notifications emailed to you.


ABOUT THE AUTHOR

Joe Fylan

Joe enjoys sharing his knowledge of WordPress to help people create websites to grow their business, promote their services, and express themselves online. You can find more of his work at joecanwrite.com

More by Joe Fylan