# Computer question: Relative links

**URL:** <https://boards.straightdope.com/t/computer-question-relative-links/330079>\
**Category:** Factual Questions\
**Created:** [November 8, 2005, 6:26pm UTC](https://boards.straightdope.com/t/computer-question-relative-links/330079 "2005-11-08T18:26:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ArrMatey](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/arrmatey/32/3522_2.png) [@ArrMatey](https://boards.straightdope.com/u/ArrMatey)\
**Post date:** [November 8, 2005, 6:26pm UTC](https://boards.straightdope.com/t/computer-question-relative-links/330079/1 "2005-11-08T18:26:10Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![muttrox](https://avatars.discourse-cdn.com/v4/letter/m/a8b319/32.png) [@muttrox](https://boards.straightdope.com/u/muttrox)\
**Post date:** [November 8, 2005, 6:30pm UTC](https://boards.straightdope.com/t/computer-question-relative-links/330079/2 "2005-11-08T18:30:47Z")

</div>

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.

Implementation:  
Absolute links, you spell it all out. For instance, “[http://www.straightdope.com/classics/a2\_420.html](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](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.

---

<div class="post-metadata">

**Author:** ![CookingWithGas](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/cookingwithgas/32/485_2.png) [@CookingWithGas](https://boards.straightdope.com/u/CookingWithGas)\
**Post date:** [November 8, 2005, 6:33pm UTC](https://boards.straightdope.com/t/computer-question-relative-links/330079/3 "2005-11-08T18:33:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ArrMatey](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/arrmatey/32/3522_2.png) [@ArrMatey](https://boards.straightdope.com/u/ArrMatey)\
**Post date:** [November 8, 2005, 6:43pm UTC](https://boards.straightdope.com/t/computer-question-relative-links/330079/4 "2005-11-08T18:43:19Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![muttrox](https://avatars.discourse-cdn.com/v4/letter/m/a8b319/32.png) [@muttrox](https://boards.straightdope.com/u/muttrox)\
**Post date:** [November 8, 2005, 6:54pm UTC](https://boards.straightdope.com/t/computer-question-relative-links/330079/5 "2005-11-08T18:54:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ArrMatey](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/arrmatey/32/3522_2.png) [@ArrMatey](https://boards.straightdope.com/u/ArrMatey)\
**Post date:** [November 8, 2005, 7:42pm UTC](https://boards.straightdope.com/t/computer-question-relative-links/330079/6 "2005-11-08T19:42:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kaon](https://avatars.discourse-cdn.com/v4/letter/k/919ad9/32.png) [@kaon](https://boards.straightdope.com/u/kaon)\
**Post date:** [November 9, 2005, 2:41am UTC](https://boards.straightdope.com/t/computer-question-relative-links/330079/7 "2005-11-09T02:41:00Z")

</div>

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.
