What a URL is

The story so far

A user clicks on a link to a page, say to rosie.html. The browser asks for the file, gets it, and renders the HTML it receives.

The file the browser asks for can be local, that is, on the same computer as the browser. Usually, though, the file is remote, on a server somewhere on the internet.

Server fetching file

The URL tells the internet what file to get. Let's break down URLs.

URLs are addresses


Joe's dog Buddy

Every file on the Web has a URL (uniform resource locator). Whether it's an HTML file, a photo file, whatever, it has a URL. A file's URL is its unique address on the Web.

Here's a URL:

https://webexamples.skilling.us/dogs/renata.html

The URL has three parts:

  • A protocol: https
  • A domain: webappexamples.skilling.us. (It's actually a subdomain. More on that later.)
  • The path: /dogs/renata.html

The protocol

The protocol is the set of rules for how clients (your browser) and servers talk to each other. When your browser wants a file, it sends the word GET to the server. When a server receives the word GET, it knows that's a request for a file.

Why the word GET, and not SENDME, or BEKOMMEN? No good reason, really. A British dude chose the word GET years ago. As long as computers agree on what word to use, it doesn't matter much what the word is.

The person who chose GET named the protocol HTTP, which stands for... you can look it up, if you care.

Here's the URL again:

https://webexamples.skilling.us/dogs/renata.html

It doesn't say "http", it says "https". The S on the end means "secure." The requests from your browser to the server are encrypted, like secret spy stuff. The responses from the server to your browser are encrypted as well.

These days, you should always use https. There isn't a good reason not to.

The domain

The URL is:

https://webexamples.skilling.us/dogs/renata.html

webappexamples.skilling.us is the domain. It's like the name of a web server. To put something on the web, you need two things:

  • A server to put the files on.
  • A name for that server, that is, a domain.

When you bought hosting from Reclaim, you got two things:

  • Space on a server to put files.
  • A name for your server space.

Your domain name is actually a placeholder for an IP address. More later. (Though not much more.)

The path

The URL again:

https://webappexamples.skilling.us/dogs/renata.html

The last bit, /dogs/renata.html, is the path.

Think about the computer you are using to read this text. It has thousands of files. They're grouped into folders. Windows, Mac OS, Linux, Android... all of them put files in folders.

/dogs/renata.html tells the server to go into the folder dogs, and look for a file called renata.html.

Put it all together

A user clicks on a link to:

https://webappexamples.skilling.us/dogs/renata.html

A conversation starts. Here it is.

Web browser: Hey, internet! I wanna send a message to webappexamples.skilling.us.

Internet: OK. What language you wanna talk in? Chinese? Swedish?

Browser: Nah, I wanna talk HTTPS.

Internet: OK. What you wanna say?

Browser: GET /dogs/renata.html

Internet: OK, I'll pass it on.

Internet: Hey, webappexamples.skilling.us!

Server: What you want?

Internet: Some browser said: "GET /dogs/renata.html"

Server: OK, wait a mo... Here: (sends contents of the file renata.html)

Internet: Yo, browser!

Browser: Huh?

Internet: webappexamples.skilling.us says this: (sends what it receives from the server)

Browser renders the HTML it got from the internet.

Servers have numbers, not names

There's a wrinkle you should know about. On the internet, computers have numbers, not names. There is no server called webappexamples.skilling.us.

Instead, there's a directory, that tells interneted computers what names match what numbers.

The numbers are IP addresses. Your Reclaim server has one. When you bought a domain name from Reclaim, they made an entry in the internet's directory, linking your name to the IP address of your server.

Exercise

Server IP address

Find the IP address of your server. There is a Server Information link in cPanel.

Summary

A URL is the address of a file on the internet (more or less). It has three parts:

  • Protocol (https)
  • Domain
  • Path

Servers on the internet have numbers, called IP addresses. A domain name is like an entry in a directory, linking names and IP addresses.

Up next

webappexamples.skilling.us is a subdomain of the domain skilling.us. Subdomains let you make many independent websites on one domain, without paying anything. Woohoo!