Content · Web Development · HTML

HTML HTML Root-Relative Paths and Deployment Subfolders

A root-relative path begins with / and starts at the website's root. It often makes shared navigation easier on a hosted site with several nested directories.

1 views Published Oct 19, 2026 Updated Oct 19, 2026 Admin

A root-relative path begins with / and starts at the website's root. It often makes shared navigation easier on a hosted site with several nested directories.

What You Need to Know


If your site is hosted inside a subfolder, /help may unexpectedly point outside that subfolder. Test against the actual deployment path, not only a local preview.

A leading slash starts at the site origin root. It often fails when the website is deployed beneath a directory such as /project/.

The goal is not to collect as many tags as possible. Pick the element that best describes what the content really is.

Example: See It in Action


This example keeps the idea small. Copy it carefully, then follow the explanation instead of guessing what the browser will do.

This is a short HTML fragment. To try it as a webpage, put it inside the body element of a complete HTML document.

<a href="/help/contact.html">Contact</a>
<a href="../contact.html">Parent-folder page</a>
<p>Root-relative paths start at the website root.</p>

Let’s Understand the Example


  • An a element becomes a working link when it has an href. Its visible text should tell readers where they will go.
  • A p groups a paragraph of related text. Start another paragraph for a new thought.
  • Href contains the destination of a link. A value starting with # points to an id on the same page.

The first example link points to /help/contact.html. Check whether that destination exists relative to the document. A link changes where readers go; it does not perform an action such as saving a form.

What Should You See?


The page should include “Contact”. If it looks different from what you expected, open developer tools and compare the source with the elements the browser created.

Try removing one piece of markup in a scratch copy, refresh the page, and compare the behavior. This is often the fastest way to understand what that piece contributes.

Try It Yourself


  1. Imagine the site moves under /school/ and update the example's links accordingly.
  2. Save your changes, open or refresh the page, and compare the result with the original example.
  3. Tell a friend what your change did. If you are not sure, undo it, refresh the page, and compare.

Common Beginner Mistakes


  • Assuming a root-relative link always starts from the project's current folder.
  • Avoid picking tags just for their default bold, italic or spaced appearance. Use CSS for presentation.

Key Takeaways


  • A root-relative path begins with / and starts at the website's root.
  • An a element becomes a working link when it has an href. Its visible text should tell readers where they will go.
  • A leading slash starts at the site origin root. It often fails when the website is deployed beneath a directory such as /project/.
Share this resourceSend this page to someone who may find it useful.