Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML HTML Basics Going Further with HTML Root-relative Paths

so if i were to make a website on my own, for another person which would i use "../" or "/"

?

1 Answer

Louise Iyengar
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Louise Iyengar
Full Stack JavaScript Techdegree Graduate 21,991 Points

You would always use "/" to access the root directory of any website on a server -- the start of a root relative path (as in <a href="/">home</a>).

Servers that host many different websites will be configured so that they can 'pretend' each site is unique on the server, and each site on the server will have its own root directory.

Servers that host many websites will often specify a directory to put webpages in (something like httpdocs or public_html) and each website will have a directory with this name. This directory will be the "/" for each site on the server.

You can also specify the first page that should load from the directory when the root path is accessed (usually index.html by default -- but this can be changed to index.php or main.js, for example). Therefore, the start of the root relative path for your website will bring up this page.