Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


Stavros Sofroniadis
Stavros Sofroniadis
Courses Plus Student 1,503 Points

About Relative & Absolute links

Dear Friends,

if we have a local website/remote server site and inside we have 2 folders:






The above folders contains these files.

If we want to link index.html with history.html we will use relative link.

But if we like to link stuff/index.html with things/index.html what kind of link it is better to use absolute or relative?

Thank You,

1 Answer

Adam Pengh
Adam Pengh
29,880 Points

It's generally better to use relative links for internal links and absolute links for external links. So on your site, linking to the various files would look like:

<a href="/stuff/index.html">Stuff</a>
<a href="/stuff/history.html">History</a>

<a href="/things/index.html">Things</a>

For example, the first link says from the web server root directory, go to the directory "stuff" and get the file "index.html"