URL, Structure of a URL, and Difference between URI and URL

An URL, or Uniform Resource Locator, is a standard web address used to identify a specific resource on the internet.
  • Save

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.

Table of Contents

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:

An URL, or Uniform Resource Locator, is a standard web address used to identify a specific resource on the internet.
  • Save

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&param2=value2#section3

  • Scheme: “https”
  • Authority:
    • Host: www.example.com
    • (Optional) Port: Default for HTTPS (port 443)
  • Path: “/path/to/resource”
  • Query: “param1=value1&param2=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:

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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

URIURL
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 IdentifierIt 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 anythingThe scheme of URL is usually a protocol such as HTTP, HTTPS, FTP, etc.
Difference between URI and URL

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

  1. Data Link Layer in OSI Model | OSI Model Data Link Layer
  2. Network Layer in OSI Model | OSI Model Network Layer
  3. Transport Layer in OSI Model | Computer Network Transport Layer
  4. Session layer in OSI Model | OSI Model Session layer
  5. Application Layer in OSI Model | OSI Model Application Layer
  6. Presentation Layer in OSI Model | OSI Model Presentation Layer
  7. Physical Layer in OSI Model | OSI Model Physical Layer

Articles on Computer Networks

  1. Introduction to Computer Networking | What is Computer Network
  2. What are Topology & Types of Topology in Computer Network
  3. What is FootPrinting in Cyber Security and its Types, Purpose
  4. Introduction to Cloud Computing | What is Cloud Computing
  5. Distributed Shared Memory and Its Advantages and Disadvantages
  6. What is a VPN? How does a VPN Work? What VPN should I use?
  7. What is an Internet and How the Internet Works
  8. What is a Website and How Does a Website or web work?
  9. Introduction to Virus and Different Types of Viruses in Computer
  10. What is TCP and its Types and What is TCP three-way Handshake
  11. What is the UDP Protocol? How does it work and what are its advantages?
  12. What is an IP and its Functions, What is IPv4 and IPv6 Address
  13. What is MAC Address and its Types and Difference MAC vs IP
  14. What is ARP and its Types? How Does it Work and ARP Format
  15. Sessions and Cookies and the Difference Between Them
  16. What is the ICMP Protocol and its Message Format?
  17. What is Big Data? Characteristics and Types of Big Data
  18. Disciplines of CyberSecurity | What are the goals of CyberSecurity?
  19. What is Firewall, Features, Types and How does the Firewall Work?
  20. Network Scanning, Types, and Stealth Scan in Computer Network
  21. Cryptography and its Types in Ethical Hacking
  22. Tor Browser and How Does It Work | Onion Router Tutorial
  23. Proxy Server, Advantages, Difference between Proxy Server & VPN
  24. DHCP Protocol and What Are the Pros and Cons of DHCP
  25. Intrusion Detection System(IDS) and What are the types of IDS
  26. Domain Name Server, How Does It Work, and its advantages
  27. Telnet: Introduction, How Does it Work, and Its Pros and Cons
  28. SOC: Introduction, Functions performed by SOC, and its Pros
  29. What is SIEM? | What is the Difference between SIEM and SOC?
  30. Application Layer in OSI Model | OSI Model Application Layer
  31. What is SSL Protocol or SSL/TLS and SSL Handshake, and Architecture of SSL
  32. What are Servers, how do they work, and its different Types
  33. Network Devices-Router, Switch, Hub, etc in Computer Network
  34. Connection Oriented and Connection-less Services in Network
  35. Physical Layer in OSI Model | OSI Model Physical Layer
  36. Presentation Layer in OSI Model | OSI Model Presentation Layer
  37. Session layer in OSI Model | OSI Model Session layer
  38. Transport Layer in OSI Model | Computer Network Transport Layer
  39. Network Layer in OSI Model | OSI Model Network Layer
  40. Data Link Layer in OSI Model | OSI Model Data Link Layer
  41. Block Diagram of Communication System with Detailed Explanation
  42. Transmission Mode, Types, Pros and Cons in Computer Networks
  43. LAN, MAN, WAN, PAN, CAN: Types of Computer Network
  44. Transmission Media | Guided and UnGuided Media in Networks
Write blogs related to Ethical hacking, Computer networks, Linux, Penetration testing and Web3 Security.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top
0 Shares
Share via
Copy link