A Googler's Sage Advice on Absolute vs. Relative URLs

Jun 10, 2008 - 7:11 am 2 by

A common question in the SEO space is should I use absolute or relative URLs. Absolute URLs are when you link a URL by using the domain.com portion as well, so linking to my authors page would be a link like https://www.seroundtable.com/authors.php. The relative URL for that authors page would be a link like /authors.php.

As you can imagine, there are pros and cons. JohnMu, a Googler, has an outstanding post in a Google Groups thread with sage advice. It would be a crime if I did not quote the whole post, so here it is:

There are pros and cons to both absolute and relative URLs in links:

Absolute URLs: + help keep the links pointing to your content if someone were to copy it (*) + help keep the links pointing to your domain name if you cannot select a canonical (can't do 301 redirects) + help make sure that you're pointing to the right URL even if you move things around (say for stylesheets or graphics) - cannot be tested on a staging / testing server (eg locally) (unless you insert the links dynamically) - makes it hard to move content (unless the links are inserted dynamically)

Relative URLs: + make it easy to move content around + make it easy to test locally and on a staging server - are easy to break if linking to content that isn't moved as well (stylesheet, graphics, etc) - an evil scraper would have less work (*)

There's a middle ground as well, using absolute links without a domain name, eg: < a href="/resources/green/mostly/page.htm" ...> Personally, I prefer to use relative URLs + some absolute (without domain name) ones to shared resources. The advantage of being able to test things out 1:1 on a staging server can't compete with the pseudo-protection against scrapers.

The only place I would use absolute URLs would be if the site is hosted somewhere where the webmaster can't do a 301 redirect and may have trouble with duplicates. I've seen this a lot with sites hosted on a free account with the ISP; often it will be hosted as http://isp.com/users/~name/site ..., then perhaps http://domain.com/site... and http://www.domain.com/site... . By using absolute URLs in that situation, any value passed to one of the wrong URLs will automatically pass value to the correct URLs as well.

If you have a really good CMS you may be able to change from one to another and use a staging server without much work. In that case, it probably doesn't matter which one is chosen.

Solid advice!

Forum discussion at Google Groups.

This post was written on June 5th and schedule to go live today.

 

Popular Categories

The Pulse of the search community

Follow

Search Video Recaps

 
Google Core Update Rumbling, Manual Actions FAQs, Core Web Vitals Updates, AI, Bing, Ads &amp; More - YouTube
Video Details More Videos Subscribe to Videos

Most Recent Articles

Search Forum Recap

Daily Search Forum Recap: March 18, 2024

Mar 18, 2024 - 4:00 pm
Google Updates

Google Urges Patience As The March 2024 Core Update Continues To Rollout

Mar 18, 2024 - 7:51 am
Google

Official: Google Replaces Perspective Filter With Forums Filter

Mar 18, 2024 - 7:41 am
Google Maps

Google Business Profiles Now Offers Additional Review After Appeal Is Denied

Mar 18, 2024 - 7:31 am
Google Maps

EU Searchers Complaining About Google Maps Features Changes Related To DMA

Mar 18, 2024 - 7:21 am
Google

Google Showing Fewer Sitelinks Within Search

Mar 18, 2024 - 7:11 am
Previous Story: Do We Need SEO Forums?