A URL stands for Uniform Resource Locator.
It is an identifier used to locate resources on the Internet, such as
web pages, images, videos, and APIs.
A URL is often compared to an address on the Internet.
Breaking Down a URL
Let's take a look at the following URL:
https://www.example.com:8080/search/articles?id=123&lang=en#summary
| Element | Value | Description |
|---|---|---|
| scheme | https |
The protocol used for communication |
| host | www.example.com |
The destination host |
| port | 8080 |
The port number used for communication (optional) |
| path | /search/articles |
The location of a resource on the server |
| query | id=123&lang=en |
Additional parameters sent to the server |
| fragment | summary |
A specific location within the page |
What Is a Scheme (HTTP / HTTPS)?
A scheme specifies how a resource should be accessed.
Most URLs begin with either http or https.
What Is HTTP?
HTTP (Hypertext Transfer Protocol) is a protocol used for exchanging
information between web browsers and web servers.
For example, when a browser sends an HTTP request asking to view a page,
the server returns appropriate data such as HTML, images, or JSON.
HTTP is also widely used for communication between applications and
services, especially in REST APIs.
What Is HTTPS?
HTTPS (Hypertext Transfer Protocol Secure) works similarly to HTTP,
but the communication is encrypted using a technology called TLS.
By encrypting transmitted data, HTTPS helps prevent eavesdropping and
tampering by third parties.
Today, HTTPS has become the standard for websites, and HTTP is generally
discouraged for public websites.
What Is a Host?
A host is a name (or IP address) that identifies a computer or service
on a network.
Strictly speaking, www. is often referred to as the hostname, while
example.com is the domain name.
Historically, prefixes such as www. and mail. were used to
distinguish different services within the same organization.
Nowadays, many websites omit www. entirely.
What Is a Path?
A path is the part of a URL that comes after the host name.
It is used to identify resources on a web server.
Traditionally, paths represented directories and files, but modern web
applications often use them to represent features, pages, or data.
What Are Query Parameters?
Query parameters are strings appended to the end of a URL to send
additional information to a server.
They are commonly used for things like search keywords and page numbers.
Examples include:
-
?q=cat -
?page=2
What Is a Fragment?
A fragment identifies a specific section within a web page.
It allows a browser to automatically scroll to a particular location.
For example, fragments are often used in tables of contents to jump to a
specific section.
Is localhost a URL?
localhost is a special hostname that refers to the current machine
itself.
It is usually resolved to the IP address 127.0.0.1.
Unlike normal website URLs such as https://google.com, localhost
represents your own computer.
For example:
http://localhost:3000/
This URL points to a service running on your local machine.
What I Learned Today
- A URL is like an address on the Internet.
- HTTP is commonly used not only for websites but also for REST APIs.
- HTTPS encrypts communication and improves security.
-
localhostis a special hostname that refers to the current machine.
Top comments (0)