Open In App

Types of URL

Improve
Improve
Like Article
Like
Save
Share
Report

URL stands for Uniform Resource Locator. Any internet location available on the server is called a web URL, web address, or website. Each website or webpage has a unique address called URL. e.g., the website of geeksforgeeks website has an address or URL called https://www.geeksforgeeks.org/

  • type: It specifies the type of the server in which the file is located.
  • address: It specifies the address or location of the internet server.
  • path: It specifies the location of the file on the internet server.

Types of URL: URL gives the address of files created for webpages or other documents like an image, pdf for a doc file, etc.

There are two types of URLs:

Table of Content

Absolute URL

This type of URL contains both the domain name and directory/page path. An absolute URL gives complete location information. It begins with a protocol like “http://” and continues, including every detail. An absolute URL typically comes with the following syntax.

Syntax:

protocol://domain/path

For web browsing, absolute URLs are types in the address bar of a web browser. For example, if it is related to our project page link on geeksforgeeks website, the URL should be mentioned as https://www.geeksforgeeks.org/computer-science-projects/ this gives the complete information about the file location path.

Note: The protocol may be of the following types.

http://, https://, ftp://, gopher://, etc.

Relative URL

This type of URL contains the path excluding the domain name. Relative means “in relation to”, and a relative URL tells a URL location on terms of the current location. Relative path is used for reference to a given link of a file that exist within the same domain.

Let us assume a web developer setting up a webpage and want to link an image called “geeksforgeeks.jpg”.

<img src="geeksforgeeks.jpg">

It would internally be interpreted like the following.

<img src="./geeksforgeeks.jpg">

The dot(.) before the “/” in the src attribute is a “special character”. It means the location should be started from the current directory to find the file location.


Last Updated : 20 Dec, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads