When you’re browsing the web, you’re using URLs all the time. Whether you follow a link, click on a bookmark, or type a website address into your browser, there’s a URL at the core of the operation. But what is a URL—and how do you edit one?
What Does That Acronym Mean?
First, you’re right to recognize that “URL” is an acronym, but the full version won’t necessarily help to explain things; URL stands for “Uniform Resource Locator”. In a simplified sense, that phrase really just means “address” and that’s exactly what a URL is: the address of a web page.
In general, a URL can be separated into five sections, each of which is more specific than the last. They’re a bit like postal addresses in much of the Western world, except in reverse order. By the end of this article, you’ll know what purpose each of those parts serves, and be able to understand any URL you come across on a deeper level than before.
The Protocol: What to Do With This URL
Most URLs you come across will be used to identify websites or individual web pages, but URLs can actually be used in other contexts; the protocol helps define this very broad context right at the beginning.
The standard protocol used to refer to websites is HTTP, but other common protocols include “mailto” (for email), “file” (for local filesystem access) and FTP (for file transfer).
There is another protocol you’ll have come across: HTTPS. As you might guess, it’s a close cousin of the standard HTTP protocol, but this URL prefix indicates it’s a “secure” version. In essence, this means that your usage of such a URL is more private than the standard HTTP alternative—you’ll often see such a URL accompanied by a padlock icon in your browser’s address bar, which may even hide the protocol altogether.
Some browsers offer their own unique custom protocols such as in the URL for Chrome’s preference page, “chrome://settings/”.
Experimenting With Addresses
Try typing “file:///” into your browser’s address bar to view files on your own computer. If you’re viewing a non-secure webpage (such as http://apache.org) try editing the URL to view the secure version instead (e.g. https://apache.org). Many sites will automatically redirect you from their standard version to the secure equivalent.
The Host: an Address for the Whole Site
The host (similar to, although not necessarily exactly the same as, the hostname or domain) is what identifies a specific “website”. It’s made of a series of parts separated by periods, and it’s often all you need to type to reach the homepage of a given company or product’s website.
The order of parts in the domain is the opposite order from the overall URL—i.e. it starts specific and gets more general as it goes. In the example, “www” is the most specific bit, then comes a more general “amazon” bit, then finally the “top-level-domain” such as “com”.
Experimenting With URLs
One of the most useful tweaks you can make to a domain is changing the final levels that refer to your location. This might be the top-level domain only, or possibly the previous part too.
For example, this book at amazon.com (the US site):
can be viewed on Amazon Germany by switching the “com” for “de”, giving:
The Path: an Address for a Specific Page
The path identifies a specific page on the URL’s website. Whilst the host started off specific and got more general as we read from left to right, the path is exactly the other way round: it starts off “most general” and gets “more specific” as it narrows down the exact location of the final page. It’s similar to the way you address files on a computer because it is, in the simplest case, doing exactly that.
Experimenting With Paths
There are no guarantees, but websites—usually the better organized ones—will often structure their paths in such a way that they can be navigated by manual editing. For example, if you’re looking at this URL:
you can try removing the last part of the path to navigate “up” a level:
The Query: URL Parameters
When a resource is more complicated than just a basic page, enter the “query string”, a collection of URL parameters which are typically name/value pairs, each separated by an “&”.
Each site (in fact, each page on a website) is free to decide everything about how it handles URL parameters, including their names. In the YouTube example, “v” refers to a specific video and “t”, a time at which to start playing the video.
Experimenting With Parameters
URL parameters offer possibly the most flexibility for URL “hacking”! For example, the YouTube URL’s “t” parameter is quite flexible; instead of seconds, it can represent minutes:
or it can combine the two:
A Fragment Identifier: Point Within a Page
Another piece of highly technical jargon which describes a simple concept, a “fragment identifier” is the most specific part of the URL, addressing an individual part of the page.
It will only be available if the underlying page supports it, but Wikipedia is a good example of how it’s done.
The links in the Contents section of the above Wikipedia URL all navigate within the same page, they just use different fragment identifiers to target different points.
Experimenting With Identifiers
Often, the first thing you’ll want to do is simply remove the fragment identifier; this is not harmful in the slightest, it will just convert a “point specific” URL into one that defaults to the top of the page. You might need to do this if you’ve clicked a “contents” link, but you want to send someone the URL to the top of the page. To do so, start with the full URL:
then simply remove the fragment identifier:
And That’s a URL!
Now you know everything about the anatomy of a URL, from protocol to fragment identifier. URLs start general and get more specific as you read them from left to right. Once you understand how each part works, you can edit a URL to make useful changes.
Another specific area that offers more information is the domain extension.
Image Credit: Chris Dlugosz/Flickr
Before 1983, visiting a host on a network required typing in its IP address. The fledgling internet was much smaller, and reaching individual sites was only possible if you knew where to look. Fortuna…
About The Author