URL anatomy
Every Component of a URL Explained in Under 2 Minutes:
First, what is a URL?
URLs represent a resource’s location on the internet (webpage, image, file, etc). When you enter a URL, your browser travels a computer network to retrieve the resource at that location.
Components of a URL (in order):
🔸 Protocol/scheme: this represents the method used to fetch the resource. E.g. HTTP, HTTPS, or FTP.
🔸 Subdomain: it comes before the domain and is optional. It’s used to organize different sections of the website.
🔸 Domain name: the location of the server that stores the website or resource. This is used in place of the server’s IP address for readability.
🔸 Path: specifies the specific resource on the web server.
🔸 Query string: used to send additional info to the server. Starts with “?”, and consists of key-value pairs (eg; ?search=hat&color=blue).
🔸 Fragment/anchor: this is optional and comes after the “#”. It is used to let the browser know to scroll to that specific part of the webpage once it is loaded.