Should I use a relative or an absolute link?

There is nothing more annoying then moving a website to a new domain name, and finding you, or somebody else, used a ton of absolute links.

Now you have to scour code and articles to fix them, since they are pointing to the old domain.  Is there a better solution?  Enter, relative links.

oookay, first things first.  What’s the difference?

A absolute link uses the entire domain name to point to your resource.  so if you want to include a url in your website, if you used a absolute link it would look like this.

absolute link

You can see there is a full url path included. (ht tp: //

Now, a relative link is when the server already knows where the file or resource is. A relative link looks like this.

relative link

In this example you can see there is no full url such as a .com

Relative URLs are great if you move your site. With Joomla 1.5 you have very little changing to do in your configuration.php. You only have to change 2 values in that file and your site is moved. If you are in the habit of using absolute urls in your content, your website designs, or your images, now is the time to fully understand how cool relative links are, and how they will save you considerable amounts of time over the long haul.

About the author

Submit a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>