In this blog, we will learn about URLs (uniform resource locators). We will see the structure of the URL and what its usage is; along with that, we will also cover the topic of URI. So let’s get started with the blog.
Introduction to a URL
An URL, or Uniform Resource Locator, is a standard web address used to identify a specific resource on the internet. It serves as a reference to locate and access various resources, such as web pages, files, images, and more. It is an essential component of the World Wide Web and is utilized in various applications and systems within computer networks.
End users can access URLs by directly putting them into their browser’s address bar or by clicking a hyperlink that they find on a webpage, in a bookmark list, in an email, or through another application.
How is a URL structured?
A URL (Uniform Resource Locator) is a standardized web address used to identify and access resources on the internet. The structure of a URL is divided into several components, each serving a specific purpose in locating and accessing the desired resource. Here’s a breakdown of the typical structure of a URL:
scheme://authority/path?query#fragment
Structure of the URL:
A) Scheme:
- The scheme specifies the protocol or method used to access the resource. Common schemes include:
http
(Hypertext Transfer Protocol)https
(HTTP Secure)ftp
(File Transfer Protocol)mailto
(Email addresses)tel
(Telephone numbers)file
(Local file access)
B) Authority:
- The authority component typically includes the domain name (or IP address) and, optionally, the port number.
- It’s often divided into:
- Host: The domain name or IP address of the server where the resource is located.
- Port: An optional port number that specifies the communication endpoint on the server. The default ports for common schemes are usually omitted (e.g., port 80 for HTTP and port 443 for HTTPS).
C) Path:
- The path specifies the specific location or route on the server where the resource is located.
- It starts with a forward slash (
/
) and can include subdirectories, filenames, or any other resource identifiers.
D) Query:
- The query component, if present, follows a question mark (
?
) and contains parameters in a key-value pair format. - Multiple parameters are separated by an ampersand (
&
), with each parameter being in the form of a “key” and “value” pair. - It’s used to pass additional information or data to the server.
E) Fragment:
- The fragment component, if present, follows a hash (
#
) and indicates a specific section or identifier within the resource. - It’s commonly used on web pages to navigate to a specific section within the page.
Here’s an example of a complete URL and its components:
https://www.example.com/path/to/resource?param1=value1¶m2=value2#section3
- Scheme: “https”
- Authority:
- Host: “www.example.com“
- (Optional) Port: Default for HTTPS (port 443)
- Path: “/path/to/resource”
- Query: “param1=value1¶m2=value2”
- Fragment: “section3”
Understanding the structure of a URL is essential for effectively navigating and accessing resources on the internet.
Types of URLs in Computer networks
In computer networking and web development, “URLs (Uniform Resource Locators)” are used to identify and access resources such as web pages, files, images, or services on the internet. URLs can be categorized into two main types: absolute URLs and relative URLs.
A) Absolute URL
An absolute URL provides the complete web address necessary to locate a specific resource. It includes the scheme (e.g., “http,” “https”), authority (domain name or IP address and port), path, query parameters, and fragment.
https://example.com/path/to/resource?param=value#section
In this example,
- Scheme: “https”
- Authority: “example.com”
- Path: “/path/to/resource”
- Query: “param=value”
- Fragment: “section”
Absolute URLs are used to specify the full path from the root of the website to the desired resource, making it clear and direct.
B) Relative URL
A relative URL specifies the location of a resource relative to the current context or location. It does not include the scheme or domain information, assuming that the resource is on the same server or within the same website.
It often used within a website to link to other pages or resources within the same domain, simplifying the link structure and allowing for easier maintenance and migration.
There are different types of relative URLs:
A) Relative URL without a leading slash (“/”):
path/to/resource
This type of relative URL is relative to the current path or directory.
B) Relative URL with a leading slash (“/”):
/path/to/resource
This type of relative URL is relative to the root directory of the website.
C) Relative URL with parent directory (“../”):
../another/path/resource
This type of relative URL allows you to navigate to a resource in a parent directory.
Relative URLs are versatile and allow for more flexible linking within a website. They simplify links, especially in cases where you want to link to resources within the same domain without specifying the full web address.
Understanding the differences between absolute and relative URLs is important for effective web development, especially when creating and managing links on websites.
Introduction to URI
A URI (Uniform Resource Identifier) is a string composed of characters that uniquely identify a particular resource on the internet. URIs are a fundamental concept in computer networking and are used to locate and access resources such as documents, images, downloadable files, and more. URIs are a superset of URLs (Uniform Resource Locators) and URNs (Uniform Resource Names).
Here’s a breakdown of the components of a URI:
- Scheme:
- The scheme specifies the protocol or method used to access the resource (e.g., “http,” “https,” “ftp”).
- It defines the rules and conventions for interaction with the resource.
- Authority:
- The authority component typically includes the domain name (or IP address) and, optionally, the port number.
- It identifies the entity that controls access to the resource.
- Path:
- The path specifies the specific location or route on the server where the resource is located.
- It helps navigate to the resources within the server.
- Query:
- The query component, if present, contains parameters in a key-value pair format.
- It’s used to pass additional information or data to the server.
- Fragment:
- The fragment component, if present, indicates a specific section or identifier within the resource.
- It’s often used on web pages to navigate to a specific section within the page.
A URI can be further classified into two main types based on their purpose and structure:
- URL (Uniform Resource Locator):
- A URL is a type of URI that specifies the web address of a resource and the means to access it, including the scheme, authority, path, query, and fragment.
- Example: “https://www.example.com/page?param=value#section”
- URN (Uniform Resource Name):
- A URN is a type of URI that identifies a resource by name in a particular namespace. Unlike a URL, it does not specify how to access the resource.
- URNs are intended to be persistent and unique identifiers for resources.
- Example: urn:isbn:0451450523 (identifying a book by its ISBN)
URIs are crucial in web development, networking, and information retrieval systems as they provide a standardized way to identify and access resources on the internet, ensuring uniformity and consistency in resource identification.
Difference between URI and URL
URI | URL |
---|---|
A URI (Uniform Resource Identifier) is a string composed of characters that uniquely identify a particular resource on the internet. | An URL, or Uniform Resource Locator, is a standard web address used to identify a specific resource on the internet. |
URI stands for Uniform Resource Identifier | It stands for Uniform Resource Locator. |
All URIs cannot be URLs, as they can tell either name or location. | All URLs are URIs, as every URL can only contain the location. |
It is commonly used in XML and tag library files such as JSTL and XSTL to identify resources and binaries. | It is mainly used to search web pages on the internet. |
The URI scheme can be a protocol, designation, specification, or anything | The scheme of URL is usually a protocol such as HTTP, HTTPS, FTP, etc. |
Note: This blog is mainly referenced from Javatpoint.
FAQ
What is the full form of the URL?
URL stands for Uniform Resource Locator.
What is the full form of the URI?
URI stands for Uniform Resource Identifier
Related Blogs on the OSI Model
- Data Link Layer in OSI Model | OSI Model Data Link Layer
- Network Layer in OSI Model | OSI Model Network Layer
- Transport Layer in OSI Model | Computer Network Transport Layer
- Session layer in OSI Model | OSI Model Session layer
- Application Layer in OSI Model | OSI Model Application Layer
- Presentation Layer in OSI Model | OSI Model Presentation Layer
- Physical Layer in OSI Model | OSI Model Physical Layer
Articles on Computer Networks
- Introduction to Computer Networking | What is Computer Network
- What are Topology & Types of Topology in Computer Network
- What is FootPrinting in Cyber Security and its Types, Purpose
- Introduction to Cloud Computing | What is Cloud Computing
- Distributed Shared Memory and Its Advantages and Disadvantages
- What is a VPN? How does a VPN Work? What VPN should I use?
- What is an Internet and How the Internet Works
- What is a Website and How Does a Website or web work?
- Introduction to Virus and Different Types of Viruses in Computer
- What is TCP and its Types and What is TCP three-way Handshake
- What is the UDP Protocol? How does it work and what are its advantages?
- What is an IP and its Functions, What is IPv4 and IPv6 Address
- What is MAC Address and its Types and Difference MAC vs IP
- What is ARP and its Types? How Does it Work and ARP Format
- Sessions and Cookies and the Difference Between Them
- What is the ICMP Protocol and its Message Format?
- What is Big Data? Characteristics and Types of Big Data
- Disciplines of CyberSecurity | What are the goals of CyberSecurity?
- What is Firewall, Features, Types and How does the Firewall Work?
- Network Scanning, Types, and Stealth Scan in Computer Network
- Cryptography and its Types in Ethical Hacking
- Tor Browser and How Does It Work | Onion Router Tutorial
- Proxy Server, Advantages, Difference between Proxy Server & VPN
- DHCP Protocol and What Are the Pros and Cons of DHCP
- Intrusion Detection System(IDS) and What are the types of IDS
- Domain Name Server, How Does It Work, and its advantages
- Telnet: Introduction, How Does it Work, and Its Pros and Cons
- SOC: Introduction, Functions performed by SOC, and its Pros
- What is SIEM? | What is the Difference between SIEM and SOC?
- Application Layer in OSI Model | OSI Model Application Layer
- What is SSL Protocol or SSL/TLS and SSL Handshake, and Architecture of SSL
- What are Servers, how do they work, and its different Types
- Network Devices-Router, Switch, Hub, etc in Computer Network
- Connection Oriented and Connection-less Services in Network
- Physical Layer in OSI Model | OSI Model Physical Layer
- Presentation Layer in OSI Model | OSI Model Presentation Layer
- Session layer in OSI Model | OSI Model Session layer
- Transport Layer in OSI Model | Computer Network Transport Layer
- Network Layer in OSI Model | OSI Model Network Layer
- Data Link Layer in OSI Model | OSI Model Data Link Layer
- Block Diagram of Communication System with Detailed Explanation
- Transmission Mode, Types, Pros and Cons in Computer Networks
- LAN, MAN, WAN, PAN, CAN: Types of Computer Network
- Transmission Media | Guided and UnGuided Media in Networks