Relative URL

A relative URL is a short link that points to another page or file on the same website without writing the full web address.

What Is a Relative URL?

A relative URL is a web link that does not show the full address with https and domain name. It only shows the path to a page or file from the current page or from the root of the same website.

Definition

A relative URL is a shortened form of a web address that starts after the domain. For example, instead of writing https://example.com/about, you can write only /about if the link goes to a page on the same site. The browser uses the current website address plus this path to find the final page.

Why Relative URLs Matter

Relative URLs are useful because they

  • Make internal links shorter and easier to manage
  • Help when moving a site to a new domain, since most links still work
  • Keep code cleaner and easier to read for developers

However, for SEO and tracking, many experts prefer absolute URLs to avoid confusion when content is copied, shared, or used on other domains.

How Relative URLs Work

The browser looks at the current page address and then adds the relative part to it. There are two common types

  • Root relative URL Begins with a slash and starts from the root of the site, for example /blog/post-1
  • Document relative URL Does not start with a slash and is based on the folder of the current page, for example images/photo.jpg

Using these rules, the browser builds the full address and then loads that page or file.

Relative URL vs Absolute URL

An absolute URL shows the full address of a page or file, including the protocol and domain, like https://example.com/blog/post-1. A relative URL only shows the part after the domain, like /blog/post-1 or post-1.

Absolute URLs are clearer for search engines and when links are shared outside the site. Relative URLs are shorter and easier to change when the domain or protocol changes.

Example of a Relative URL

Imagine your current page is

https://example.com/blog/

Examples of relative URLs from this page

  • post-1 points to https://example.com/blog/post-1
  • ../about goes up one folder and points to https://example.com/about
  • /contact points to https://example.com/contact from the site root

FAQs

Is a relative URL good for SEO
Relative URLs work for SEO if used correctly, but many SEO experts recommend absolute URLs to avoid mistakes in sitemaps, canonical tags, and shared links.

When should I use a relative URL
Use relative URLs mainly for internal links inside your own site, especially during development or when you might change your domain later.

Can I mix absolute and relative URLs
Yes, you can mix them, but try to be consistent for important things like canonical tags and hreflang links, where absolute URLs are usually safer.

Do relative URLs work across different domains
No, a relative URL only works inside the same website. For linking to another website, you must use an absolute URL.

Written by:

Picture of Team Bluelinks Agency

Team Bluelinks Agency

Posts authored by Team Bluelinks Agency represent official, verified content meticulously crafted using credible and authentic sources by Bluelinks Agency LLC. To learn more about the talented contributors behind our work, visit the Team section on our website.
Stay Updated, Subscribe Free