Open In App

What is URL (Uniform Resource Locator) ?

Last Updated : 23 Jan, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

A URL or Uniform Resource Locator is a Unique identifier that is contained by all the resources available on the internet. It can help to locate a particular resource due to its uniqueness. It is also known as the web address. A URL consists of different parts like protocol, domain name, etc. The users can access the URLs by simply typing them inside the address bar or by clicking any button or link web page.

URL-copy

URL

Example URL:

https://www.geeksforgeeks.org/

Structure of a URL

A URL starts with a protocol followed by the name of the resource that has to be accessed. URL uses the protocols as the primary access medium to access the domain or subdomain specified after that wherever the resource is located. It uses multiple protocols like HTTP (Hypertext Transfer Protocol), HTTPS Protocol (Secured HTTP), mailto for emails, FTP (File Transfer Protocol) for files, and TELNET to access remote computers. Mostly the protocol names are specified using the colons and the double forward slashes, but the mailto protocol is specified using the colons only.

Optional Parts after the domain name in a URL:

  • A path to a particular page or file can be specified.
  • Some extra query parameters can also be specified.
  • Network port to make the connection.
  • Reference to a particular point in the file or a HTML element on the page.

Different Parts of a URL

A URL consists of mutliple parts that can helps you to visit a particular page on the internet. Every part of a URL has its own importance. Let us discuss about the different parts of a URL.

url-parts-copy-(1)

Reference URL:

https://www.geeksforgeeks.org/array-data-structure/?ref=home-articlecards#what-is-array

The protocol or scheme:

A URL starts with a protocol that is used to access the resource on the internet. The resource is accessed through the Domain Name System or DNS. There are multiple protocols avaiable to use like HTTP, HTTPS, FTP, mailto, TELNET etc. The protocol used in the above URL is https.

Domain or Host Name:

It is the reference or name of the page that you are going to access on the internet. In this case, the domain name is: www.geeksforgeeks.org.

Port Name:

It is defined just after the domain name by using the colons between itself and the domain name. Generally, it is not visible in the URL. The domain name and the port name combinely can be known as Authority. The default port for web services is port80 (:80).

Path:

It refers to the path or location of a particular file or page stored on the web server to access the content of it. The path used here is: array-data-structure.

Query:

A query mainly found in the dynamic pages. It consists of a question mark(?) followed by the parameters. In above URL query is: ?.

Parameters:

These are the pieces of information inside a query string of URL. Multiple parameters can be passed to a URL by using the ampersand(&) symbol to separate them. The query parameter in above URL is: ref=home-articlecards.

Fragments:

The fragments appear at the end of a URL starts with a Hashtag(#) symbol. These are the internal page references that refers to a specific section within the page. The fragment in the above URL is: #what-is-array.


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads