What is a URL?
What you'll learn: How web addresses are structured and what each part means.
Understanding URLs
A URL (Uniform Resource Locator) is the complete address you type into your browser to visit a webpage. Just like a physical address tells you the country, city, street, and house number, a URL tells your browser exactly where to find a resource on the Web.
The Anatomy of a URL
Let's break down this example:
https://www.example.com/blog/article?id=123
1. Protocol (https://)
This is how the browser should communicate with the server. Think of it as choosing between calling someone on the phone versus sending them a letter. https:// means "use a secure connection."
2. Domain (www.example.com)
This is where the resource lives on the Internet. Remember from our DNS lesson? The domain name gets translated into an IP address so your browser can find the right server—just like looking up a phone number.
3. Path (/blog/article)
This tells the server which specific resource you want. It's like navigating through folders on that server: first the "blog" folder, then the "article" file inside it.
4. Query Parameters (?id=123)
These are optional extras that provide additional information. The ? starts the query section, and id=123 tells the server "I want article number 123." Multiple parameters are separated by &, like ?id=123&lang=en.
Real-World Analogy
Think of a URL like mailing a package:
- Protocol = delivery method (standard mail vs. express)
- Domain = recipient's address
- Path = specific room in the building
- Query parameters = special delivery instructions
Key Takeaway: A URL has four main parts—protocol, domain, path, and query parameters—that work together to tell your browser exactly what resource to fetch and how to get it.