Tuesday, March 3, 2009

using absolute and relative URLs

COM

JohnMU clarifies the benefits of using absolute and relative URLs.

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