January 16th, 2008 - by Golgotha

Absolute vs. Relative Links – Which is Better?

There are two ways to link to a file/page/location in HTML, either by using absolute or relative paths:

An absolute path defines a location by including the protocol, the server/domain, the directory (if needed) and the name of the document itself. Below is an example of an absolute path:

<a href="http://www.search-this.com/page.html">

With a relative path, you skip the protocol and server/domain name and go directly to the page name, like so:

<a href="/page.html">

So which is better?

Well you’ll get different responses depending on who you ask. Many people will tell you that relative paths are better but I’m not one of them! I always recommend absolute paths and here’s why:

At one point GoogleGuy, an employee of Google, who helps fight crime — or at least helps webmasters — said, and I quote, “absolute links have less potential for getting messed up [when Google indexes your page]. Even though it shouldn’t make a difference, I recommend absolute links.”

OK, sure, maybe just because GoogleGuy said so is not a good enough reason. I agree. So here is — we live in a time where people scrape your content and place it on their own site. If you’re going to get scraped you may as well get a link back to your site, right? That’s only going to happen with an absolute path!

And it’s not just scrapers. There are other legitimate ways to have your content show up on other sites; like RSS and web-services. I think in todays web, it’s no longer just personal preference; absolute paths are the way to go.

20 Responses to “2 Minute SEO Tip – Absolute vs. Relative Links”

1 Jack @ The Tech Teapot

I think you’re right. We are using relative at the moment and it will be a big job to move over to absolute. I’ve seen instances where Google has got links wrong. Google cache doesn’t seem to work too well either with relative links.

2 Dustin Brewer

I don’t agree with this at all for a lot of reasons. Trying to make your site get in-links from scrapers is a null point and ridiculous.

You want to use relative paths as much as possible, they are not only going to take the file size of your site down but when working from a development point of view it is mandatory to use relative links.

The biggest reasons for this is most developers use a “development subdomain” that you will be working on the project until it goes live. You don’t want to go back and change all of them to the new domain if you are using absolute.

Using relative paths is a just good practice (almost a standard) in web design.

3 Jack @ The Tech Teapot

@Dustin – using a config file is pretty easy to do with the correct domain to use on your live domain and your stage sub-domain.

4 Golgotha

@Dustin – “Trying to make your site get in-links from scrapers is a null point and ridiculous.”

Not when your site is scrapped by a dozen sites like this one is…

“You want to use relative paths as much as possible, they are not only going to take the file size of your site down”

file size, talk about a null point…

And Jack is dead on, you would just use a config file to change from development to production. It’s real simple. It’s what WordPress does, and it’s what you should do too.

So in the end relative pathing gains you nothing, save a few bytes.

5 Adi

Well recently it was revealed that “GoogleGuy” is none other than Matt Cutts. :)
Hence, obviously what he has said, is definitely correct.

6 Ahmet

One more reason to enter absolute path:
You will write more time your domain name (considering it makes certainly part of your SEO strategy), I totally agree with what you said: Absolute path is the way to do it :)

7 URLs and SEO and Internet Marketing

[...] Absolute vs. Relative Links – Which is Better? (Search-This) — “Well you’ll get different responses depending on who you ask. Many people will tell you that relative paths are better but I’m not one of them! I always recommend absolute paths and here’s why…” [...]

8 Web Design Media

There’s no point in saving a few bytes when using relative links…except if each page of your website contains thousands of links. However, as @Dustin says, relative links is a good practice.
We can’t deny the fact that in-links contribute to page ranking.
So, the solution is simple. You just have to use both of them, wherever necessary.

9 Wil

The only pain with absolute links, which I do prefer for too many reasons to list (and only a few for “not”) is when your internal or external engine points you to the “www” path (or not) and when you get your search results you get relative links.

If your absolute links take you from there to a “www” path (or not) and you have login credentials on that folder, you’ll be prompted for login credentials everytime you go from “www” to just “http” and vice versa, so there’s the chance for one addtl. login prompt along an absolute path where htaccess exists in the folder….

10 Chris Shepherd

Absolute links are better in my opinion and you could say yeh but what happens moving from dev to test servers with different base domains… however if you use a content mgt system then this can be managed quite easily.

If the end product in the HTML is an absolute link, then that’s the best for me, even if what’s stored in the CMS is a relative link making it best practice.

11 Link Building Bible

Wow…. I never thought of it with regards to scraping, but this is awesome! I will be writing about this very soon on my blog in my internal link building series.

[...] this one is a tough question. There is numerous number of posts concerning this subject. I decided to put all that together in a single [...]

13 Michael Hoskins

@Jack – A configuration file? Meaning for every link you’d need server-side code prefacing every link to fill in the domain? No thanks.

@Golgotha – And Google (well, Matt Cutts) has already stated that for some sites that do scrape, getting links from them will result in a penalty.

I also disagree that file size is a “null point.” If all you’re after is rankings, usability be damned, then go right ahead. The rest of us have to balance many factors, file size being a small factor, but development server URLs are the main benefit of relative URLs.

@Adi – Recall that Matt Cutts does not speak from an SEO-only perspective. He, as with all engineers at Google, is focused on making the web more usable for humans, not for SEOs.

14 Mark

My dedicated server host told me my server halted yeserday due to too many internal full URL links on the home page. The problem was “too many connections.” I was using the full path to bring up about 20 clickable thumbnail images which brought people to internal articles. He said that each of these created a new instance, or new connection. He said that relative path links did not create this problem.

The crash happened twice, and after I changed the links, it was fine.

Anyone here ever hear of anything like this?

15 sudheer

You will write more time your domain name (considering it makes certainly part of your SEO strategy), I totally agree with what you said: Absolute path is the way to do it.We can’t deny the fact that in-links contribute to page ranking.
So, the solution is simple. You just have to use both of them, wherever necessary.

16 sudheer

Absolute links are better in my opinion and you could say yeh but what happens moving from dev to test servers with different base domains… however if you use a content mgt system then this can be managed quite easily.

17 Joe SEO

This subject has always been full of opions and no substance. Can anyone state any real test results. From my own tests I have seen better results with relative links. My opinion is that Google passes on more juice for internal links (relative) than they do for absolute links. I wouldn’t trust any statement from google regarding seo, because many times in the past they have said one thing and their ranking result so different. Hell, they came up with the “nofollow” and they don’t even use it. The SEO community and Google are not friends, Period!!

18 Elegant Dresses

I prefer relative links,
This will make you page clean and reduce the size of your page.

Second from the spider side,
for a absolute path, they need one more step to check if the link is a internal link.

19 Squidly

One issue regarding relative vs. virtual, relative paths can reduce DNS lookup depending upon your DNS provider caching mechanism and which browser is in use. However, using different hosts for external files can decrease load time as your browser can concurrently load more resources from separate hosts. For example, we use media.domain.com host to server our media, even though it is coming from the same physical system as http://www.domain.com, and this greatly improves browser performance. However again, we use relative links for internal page links almost exclusively for a whole host of reason, related to and not related to SEO specifically. I don’t believe there is one single simple answer to this question. The answer demands a blend of methodologies for a very wide variety of reasons.

20 Absolute Code

I always prefer relative linking due to the lightweight nature of the code. However, I’m wondering if things like domain mentions inside of the code make absolute linking the better choice for SEO purposes.

mulberry sale spyder womens jacket cheap new balance 574 mulberry outlet cheap new balance 574 arcteryx outlet mulberry sale spyder womens jacket mulberry sale spyder womens jacket mulberry outlet mulberry outlet new balance 574

Popular Articles

Top 10 Commentators


Subscribe to this feed! Subscribe by Email!

Random Bits Podcast

You need to download the Flash player from Adobe

Blogs Worth Reading


    Warning: fopen(./wp-content/themes/big-blue/my_blogroll.php): failed to open stream: Permission denied in /home/mangeletti/search-this.com/wp-content/themes/big-blue/get_blogroll.php on line 5

    Warning: fread() expects parameter 1 to be resource, boolean given in /home/mangeletti/search-this.com/wp-content/themes/big-blue/get_blogroll.php on line 6

    Warning: fclose() expects parameter 1 to be resource, boolean given in /home/mangeletti/search-this.com/wp-content/themes/big-blue/get_blogroll.php on line 7
  • Smashing Magazine