What Is a URL? Definition, Structure and How It Works

Everything you need to know about the URL: its definition, its structure and components, and the difference between a relative and an absolute URL.

Definition

URLs (Uniform Resource Locators) are one of the essential building blocks of navigating the internet. Their job is to uniquely identify a resource on the web, whether it is a web page, an image, a file, or any other resource.

What is a URL used for?

On a WordPress site, every page you create gets its own unique URL, also called a permalink, which you can configure for every piece of content you write. But every media file you add to the library (an image, a video, a PDF, and so on) also gets its own unique URL, just like any resource on the internet. That is how you can reach each of these resources: by going to its unique URL.

URLs are therefore fundamental to the modern internet, providing a structure and an organization that let users reach a huge range of online resources quickly and efficiently. That means URLs play a role in several areas, including:

  • An identification role: URLs uniquely identify every resource on the web
  • A role in SEO: since every resource on the web can potentially be indexed by a search engine, URLs sit at the heart of search rankings, especially on Google, and optimizing them can have a slight impact on your rankings
  • A sharing role: any web resource can be shared with any user through its URL, which is the very essence of the internet

The structure and components of a URL

1. The protocol

It defines the communication protocol. For a web page, it will be HTTPS (plain HTTP has been strongly discouraged for a long time now).

2. The domain name

Every URL includes the domain name, which points to the server that holds the web resource to display. E.g. wooordpress.com

3. The path

The path specifies where the resource lives on the server, starting from where the domain name points. E.g. /en/what-is-a-url/

4. The fragment

The fragment lets you reference a specific section of the resource. You use it, for example, to send a visitor straight to a specific section of a page instead of leaving them to scroll all the way down to it. E.g. #section Together, these four components form a complete URL.

The different types of URL

1. The absolute URL

The absolute URL is what you use most of the time to share a page across the internet. It is the “classic” look of a URL.

2. The relative URL

The relative URL contains only the path (and possibly the fragment of the section concerned) to where the resource sits, starting from where the domain name points. This kind of URL is what you use when you want to create a link to a page on the same site. Indeed, if no protocol and no domain name are specified in a link’s address, the browser deduces that it is a link to the same website as the current page, and automatically fills in the protocol and the domain name. Creating links with their relative URL rather than their absolute URL means, for instance, that those links do not depend on the site’s domain: if it ever changes, every link is automatically up to date without any manual work. Without going into the details, you can also use relative URLs in more advanced development to fetch or include a resource that lives upstream of where the domain points. That resource is therefore not reachable any other way than through the code itself, as a security measure.

FAQ

What is the difference between a URL and a domain name?

The domain name (wooordpress.com) is only one part of the URL: it names the site. The full URL adds the protocol, the path and sometimes a fragment to point to one exact resource. In other words, the domain identifies the site, while the URL identifies every page or file inside it.

What is a slug (or permalink) in a URL?

The slug is the readable part of the path that identifies a specific page, for example "what-is-a-url" in this address. In WordPress it is called a permalink, and you can edit it for each piece of content. A good slug is short, clear and contains your keywords, with no accents or special characters.

How do you structure a URL for good SEO?

Keep it short, readable and descriptive: HTTPS, keywords separated by hyphens, no accents or capital letters, and a logical hierarchy. Avoid strings of numbers or cryptic parameters. The impact on rankings stays modest, but a clean URL also reassures your visitors.

What are URL parameters (the query string, ?...=)?

Parameters, introduced by a "?" followed by key=value pairs, pass information to the server: a search term, a filter, a language or a campaign tag. Handy and dynamic, they can nonetheless complicate SEO and bloat your URLs. Use them sparingly on pages you want indexed.

Can you change a WordPress page URL without hurting your SEO?

Yes, as long as you set up a 301 redirect from the old URL to the new one. Without that redirect, your old links and your Google ranking turn into 404 errors. Edit the permalink, create the redirect, then check it: your traffic and your rankings stay safe.

Blaminhor Building what's missing.

Comments