Parts of a URL

Parts of a URL

06.Nov.2021

When we talk about a website's address, we usually call it a URL (Uniform Resource Locator).

A URL is basically the location of a file on the internet and the way to download it.  But there are many different parts that make up what people think of as just one address.  This article will discuss how all those parts come together to form what appears to be just one address and how each part plays an important role in getting you to the page you want.

 

The first part of your browser's request for a webpage is always the protocol:// This tells your computer which mode it should use when sending or receiving information from another computer; HTTP(Hypertext Transfer Protocol) and HTTPS (HTTP Secure) are the two most common types of protocols on the internet.

 

Next is the domain name: This tells your browser how to find and identify the server where the requested file resides. For example, google's domain name is Google.com so when you type google.com into your browser, it knows to send a request for information to Google's servers and google.com also works as an identifier that distinguishes them from any other company with a similar name (Yahoo!, Bignigge, etc.)  For this reason some people choose to buy domains that follow certain patterns such as all lower-case letters or end in ".info" - these are called generic top-level domains (gTLDs).  Domains are considered "generic" if they don't contain a suffix such as ".com", ".co.uk", etc., but there are many more gTLDs available today including ones for cities, hobbies, and occupations.

 

After the domain name comes the path:/path/file or directory The path tells your browser which specific file on that server you want - this is almost always just one file on one directory on that server.  The reason it's divided into two parts is because sometimes web servers have different names for directories depending on who you're asking (more about that later).

 

The next part is the query string: ?querystring This part of the address includes optional information that your browser sends along to the server along with the requested file.  For example, if you go to https://www.google.com/search?q=dogs, this tells Google's servers that you want to see results for dogs rather than cats or turtles or anything else.

 

Last but not least is the resource name:/path/file?querystring This part of a request URL tells your browser where on the server it'll find the file it wants and what specific version (if there are multiple) it's looking for; "/path/file" is always required but "?querystring" is excluded when there is no query string in the other parts of the request.  Now that we've covered all the parts and what they do, let's look at how each part plays a role:

 

Domain Names: These names help your browser figure out who to ask for information and where to find them. They also serve as an identifier; google.com is easily distinguished from Yahoo! or Bignigge even though they all end in ".com". Generic Top-Level Domains (gTLDs): These are like words that can be used as domains - ".coffee" could refer to any company with that domain but "google" can only mean one company; this makes it easy for you to remember certain websites because their gTLDs are words that describe what they're about. Paths: This tells your browser which file to find on the server, how to find it, and where it is within that server's directory structure.  For example, if you type "google.com" into your browser, it looks up Google's domain name on the internet so it knows who to ask for information.  Then it sends a request for any files located at https://www.google.com/ which is Google's main page located at / - this means there will be no path because there is nothing after the first forward slash in the address bar but your browser still understands the request as being for https://www.google.com/.

Queries: These are like optional instructions that tell your browser how to look for the file you requested.  For example, if you type "google.com" into your browser, it looks up Google's domain name on the internet so it knows who to ask for information; then it sends a request for any files located at www.google.com/search This is Google's main page located at / but why does this one have a path? The reason is because "/search" tells your browser that there might be more than just one version of this file and to look in /search for any versions - this part of the path is called a directory (more about directories later) so now google.com/search could also refer to https://www.google.com/search?q=dogs&gws_rd=ssl which is Google's main page located at /search but with a query string attached telling it to look for files containing the words "dogs" and "gws_rd=ssl"

We are social