Related Articles

Related Articles

Types of URL
  • Last Updated : 27 Nov, 2020

URL stands for Uniform Resource Locator. Any internet location available on 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

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 URL:

  • Absolute URL
  • Relative URL

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.


For web browsing, absolute URL’s are types in the address bar of a web browser. For example, if it is related to our project page link of geeksforgeeks website, the URL should be mentioned as this gives the complete information about the file location path.

Note: The protocol may be of 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.


My Personal Notes arrow_drop_up
Recommended Articles
Page :