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 “w3wiki.jpg”.

<img src="w3wiki.jpg">

It would internally be interpreted like the following.

<img src="./w3wiki.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.


Types of URL

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 w3wiki website has an address or URL called https://www.w3wiki.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
  • Relative URL

Similar Reads

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....

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....

Contact Us