Does it make sense to use Craft with relative links? A coworker of mine asked me if I could make the links in Craft relative.

Which is not a big deal for navigation links,

relative url:

{% set relativeUrl = entry.url|replace((siteUrl), '/') %}


but it gets trickier for links inside a Rich Text field.

Craft is set up to use absolute links, is there a reason behind that?
I would question the need to have relative URLs to begin with.

As Brad mentions, Craft neatly solves the multi-environment problem for you.

If you come from an environment like WordPress where it makes absolute URLs for you and then you end up having to do a find-replace on the content when switching environments (since there's no "built-in" way to do it), I can see where your co-worker might think relative is the way to go. However, even WP has good reason to do so.

Back before content management systems, relative URLs were probably the way to go because they are easier to code by hand; if you used conventions like "../" your pages also worked locally. Now with systems like Craft and local testing servers, creating links within content is much more consistent.

Craft even has a find/replace tool in the CP if you want to make sure those staging/production URLs absolutely get switched over in the database as well.

Speaking of consistency, google wants you to be as efficient as possible. From an SEO perspective, this moz post goes over the pros and cons of relative vs absolute but a few points worth summarizing:


Scrapers can be a big problem stealing your content. Absolute URLs make it a bit more difficult for the laziest of them. 
By using things like rel="canonical" and letting Craft spit out your main base URL consistently, you can help avoid duplicate content issues.


Yoast gives some thoughts on this as well but I'll leave you with one takeaway:


  The few minutes a developer might save by using relative URLs are offset by countless hours an SEO might be spending to solve the issues caused.