Relative path

Web pages consist of web links. The links can send users either to external sites or to pages on the same site which is internal links. Internal links can be created by using either absolute path or relative path.

Relative path is a path relative to the current page's path location. Current page is the page that contains the URL link.

Conversely, a relative link only includes the name of a specific file or page, which is relative, to the current path. If you keep all of your website’s files in a single directory, you can establish links between pages as follows:

<a href="/pathto/page2.html">Next page</a>

In this case, the link is only valid within the directory that page2.html is located. When clicked, the browser searches the current page’s directory for page2.html and displays it. Of course, if you just pasted page2.html into a browser’s search bar, it wouldn’t take you where you wanted to go.

Therefore, the link’s path is relative to the current document being displayed by the browser, hence the term relative path.