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.

HTML HTML Basics Going Further with HTML Root-relative Paths

Hyeji Kim
Hyeji Kim
1,552 Points

a href="../../index.html" doesn't work

at article.html page, i used code <a href ="../../index.html"> to go back to "home" page, but Not found error occurred.. I don't know why it doesn't work..

I guess it related to this: if i click the preview button, it goes not to index.html, but page like that.. Index of / [ICO] Name Last modified Size Description [TXT] Index.html 2021-12-05 11:40 3.7K
[DIR] articles/ 2021-12-04 05:22 -
[DIR] img/ 2021-12-04 05:49 -
Apache/2.4.18 (Ubuntu) Server at port-80-a8trrzarjo.treehouse-app.com Port 80

i don't know why it doesn't go index.html page directly

  <li><a href="../../index.html">Home</a></li>
  <li><a href="../../index.html#about">About</a></li>
  <li><a href="../../index.html#articles">Articles</a></li>
  <li><a href="../../index.html#contact">Contact</a></li>

4 Answers

Steven Parker
Steven Parker
218,833 Points

Is article.html located in a directory two levels below where index.html is? Otherwise, this would not be a correct href to get to it.

If that's not the issue, please share the whole project. Make a snapshot of your workspace and post the link to it here.

In the video, the instructor's "article.html" file is in the folder "articles/2017/". If you did not create that subfolder and move the file there, the pathing will be incorrect. If you only have the Articles folder, and that is where your article.html file is, then the path for the href would just be "../index.html"

Charlie Palmer
Charlie Palmer
15,443 Points

If you share an image of the folders/directory so we can see the relation between the files. I tend reference them starting with './'

Mahomede TCHAPOU
Mahomede TCHAPOU
1,716 Points

can you share the complete html code sheet or doc to. see where is the problem!