View Full Version : Computer question: Relative links
11-08-2005, 12:26 PM
A pretty basic question. Can someone explain to me, in small words, as I'm tech illiterate, the difference and implementation of relative hyperlinks as opposed to absolute ones?
11-08-2005, 12:30 PM
An absolute reference is like saying, go to the following GPS coordinates.
A relative reference is like saying, go x miles north of here, y miles east of that.
A relative reference is a reference to a directory/file, and the directions of where it's located are given in reference to the current page.
Absolute links, you spell it all out. For instance, "http://www.straightdope.com/classics/a2_420.html"
Relatvie links, you only spell out what is needed. For instance, a link from http://www.straightdope.com to the same link might read as "/classics/a2_420.html" Notice this same link would not work if it were placed on the NY Times website, or anywhere else on the web.
11-08-2005, 12:33 PM
Developers generally stick with relative links since they will be developing and testing the code in multiple environments. You don't really want to rewrite the code every time you move to a different environment.
11-08-2005, 12:43 PM
So, relative links, if I get this right, are like saying, "Okay, you're already at the website, here's where to go from here."? And it really consists of just adding, in essence, an extention to where you're already at?
11-08-2005, 12:54 PM
Yes, that's exactly right. As Cooking With Gas pointed out, one of their strengths is that if your main level URL changes for some reason, nothing breaks.
11-08-2005, 01:42 PM
Sweet. Thanks for the info. I was staring at the help file on it in OpenOffice for some time, and my sleep-deprived brain just couldn't process it.
some useful to know things off the top of my head:
. (single dot) means "current location" or "my own location". (often you can say either "./dir" or just "dir".)
.. (double dot) means "my parent directory" or "up one level". (you can use this to go up a tree and then down into a sibling directory of your current location, e.g. "../sibdir"
/ (forward slash) is used in web and unix paths and almost everything other than DOS or Windows paths.
\ (back slash) is used in Windows or DOS paths
a leading slash means the (effective) root directory.
vBulletin® v3.7.3, Copyright ©2000-2013, Jelsoft Enterprises Ltd.