The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

relative vs. absolute links - the final answer

the "relative vs. absolute links" question comes up here and everywhere else way too often to count so here is the answer you all need,from GoogleGuy.

Sometimes a tangent isn't such a bad thing though. For example, partway into the Bourbon discussion, wattsnew asked if there was a technical guide on how to handle www vs. non-www, relative vs. absolute linking, and links to different pages such as / vs. index.html vs. default.asp. My rule of thumb is to pick a root page and be as consistent as possible. I lean toward choosing http://www.yourdomain.com/ but that's just me; http://yourdomain.com/ would work as well. Then I recommend that you make things as simple as possible for spiders. I recommend absolute links instead of relative links, because there's less chance for a spider (not just Google, but any spider) to get confused. In the same fashion, I would try to be consistent on your internal linking. Once you've picked a root page and decided on www vs. non-www, make sure that all your links follow the same convention and point to the root page that you picked. Also, I would use a 301 redirect or rewrite so that your root page doesn't appear twice. For example, if you select http://www.yourdomain.com/ as your root page, then if a spider tries to fetch http://yourdomain.com/ (without the www), your web server should do a permanent (301) redirect to your root page at http://www.yourdomain.com/So the high-order bits to bear in mind are
- make it as easy as possible for search engines and spiders; save calculation by giving absolute instead of relative links.
- be consistent. Make a decision on www vs. non-www and follow the same convention consistently for all the links on your site. Use permanent redirects to keep spiders fetching the correct page.

Those rules of thumb will serve you well no matter what with every search engine, not just with Google. Of course, the vast majority of the time a search engine will handle a situation correctly, but anything that you can do to reduce the chance of a problem is a good idea. If you don't see any problems with your existing site, I wouldn't bother going back and changing or rewriting links. But it's something good to bear in mind when making new sites, for example.