Opening a local file on your computer is as simple as double-clicking it, but to open files on remote computers, like web servers, we must use URLs so that our web browser knows where to look. For example, opening the HTML file that represents the web page explained below, is done by entering it into the navigation bar at the top of the browser you’re using.
Other Names
Uniform Resource Locators are most commonly abbreviated as URLs, but they’re also called website addresses when they refer to URLs that use the HTTP or HTTPS protocol. URL is usually pronounced with each letter spoken individually (i.e., u - r - l, not earl). It used to be an abbreviation for Universal Resource Locator before being changed to Uniform Resource Locator in 1994.
Examples of URLs
You’re probably used to entering in URL, like this one for accessing Google’s website: The entire address is called the URL. Another example is this website (first) and Microsoft’s (second): You can even get super specific and open the direct URL to an image. For example, the following URL leads to Google’s logo on Wikipedia’s website: You can see that it starts with https:// and has a regular-looking URL like the examples above, but then has lots of other text and slashes in order to point you to the exact folder and file where the image resides on the website’s server. The same concept applies when you’re accessing a router’s login page; the router’s IP address is used as the URL to open the configuration page. Most of us are familiar with these types of URLs that we use in a web browser like Firefox or Chrome, but those aren’t the only instances where you’ll need a URL. In all these examples, you’re using the HTTP protocol to open the website, which is likely the only one most people encounter, but there are other protocols you could use, too, like FTP, TELNET, MAILTO, and RDP. A URL can even point to local files you have on a hard drive. Each protocol may have a unique set of syntax rules to reach the destination.
Structure of a URL
A URL can be broken down into different sections, each piece serving a specific purpose when accessing a remote file. HTTP and FTP URLs are structured the same, as protocol://hostname/fileinfo. For example, accessing an FTP file with its URL might look something like this: Which, aside from having FTP instead of HTTP, looks like any other URL you might encounter out there on the web. Let’s use the following URL as an example of an HTTP address and identify each part:
https is the protocol (like FTP is a protocol) that defines the type of server that you’re communicating with. security is the hostname used to access this specific website. googleblog is the domain name. com is what’s referred to as the top-level domain (TLD), some others of which include .net, .org, .co.uk, etc., though .com is the most common. /2018/01/ represents the directories used to organize the web page or file. On the web server that’s holding the website files, these would be the actual folders that you’d click through to find the file that this URL is specifying. todays-cpu-vulnerability-what-you-need.html is the actual file that the URL is pointing to. If you were trying to load an image, audio file, or another file type instead of an HTML file, then the URL would end in that file extension (like a PNG or MP3). security.googleblog.com as a group is called the Fully Qualified Domain Name (FQDN).
URL Syntax Rules
Only numbers, letters, and the following characters are allowed in a URL: ()!$-’_*+. Other characters must be encoded (translated to programming code) in order to be accepted. Some URLs have parameters that split it away from additional variables. For example, when you do a Google search for lifewire: The question mark you see is telling a certain script, hosted on Google’s server, that you want to send a specific command to it in order to get custom results. The specific script that Google uses to execute searches knows that whatever follows the ?q= part of the URL should be identified as the search term, so whatever is typed at that point in the URL is used to search on Google’s search engine. You can see similar behavior in the URL in this YouTube search for best cat videos: Some URLs can swap between parameters depending on the context. A good example can be seen when adding a timestamp to a YouTube video. Some links require an ampersand and others use a question mark. URLs can also use anchors. These are situated at the very end and describe where, on that page, to jump to when the link is selected. Anchors are created when adding links to a web page, and they use the number sign (#). Here’s an example in a Wikipedia entry where the anchor takes you to another part of the page: The first variable, url, is preceded by the question mark, but the next variable, field-keywords, is preceded by an ampersand. Additional variables would also be preceded by an ampersand. Parts of a URL are case-sensitive—specifically, everything after the domain name (the directories and file name). You can see this for yourself if you capitalize the word “need” in the example URL from Google that we deconstructed above, making the end of the URL read todays-cpu-vulnerability-what-you-NEED.html. Try to open that page, and you can see that it doesn’t load because that specific file doesn’t exist on the server.
More Information on URLs
If a URL points you to a file that your web browser can display, like a JPG image, then you don’t have to actually download it to your computer to see it. However, for files that aren’t normally displayed in the browser, like DOCX files, and especially EXE files (and many others), you’ll be prompted to download it. URLs provide an easy way for us to access a server’s IP address without needing to know what the actual address is. They’re like easy-to-remember names for our favorite websites. This translation from a URL to an IP address is what DNS servers are used for. Some URLs are really long and complex and are best used if you click it as a link or copy/paste it into the browser’s address bar. A mistake in a URL could generate a 400-series HTTP status code error, the most common type being a 404 error. Clicking through to URLs you’re unfamiliar with, or that look strange, can actually be dangerous. Since a URL shortener service can mask the destination address, it’s not always clear where you’ll end up when you click a hyperlink in an email, load one from a QR code, follow one from a website, etc. Learn how to test a suspicious link without clicking it to help avoid issues surrounding this. If you try to access a page that doesn’t exist on the server, you’ll get a 404 error. These types of errors are so common that you’ll often find custom, often humorous, versions of them on some websites. If you’re having trouble accessing a website or online file that you think should be loading normally, try troubleshooting the URL. Most URLs don’t require the port name to be given. Opening google.com, for example, can be done by specifying its port number at the end like 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. By default, FTP sites use port 21, but others may be set up on port 22 or something different. If the FTP site isn’t using port 21, you have to specify which one it’s using to access the server correctly. The same concept applies to any URL that uses a different port than what the program used to access assumes by default that it’s using.