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

PHP Enhancing a Simple PHP Application Cleaning URLs with Subfolders Server Paths and Constants

steven schwerin
steven schwerin
7,722 Points

Including Constants Code Challenge

I'm not sure I understand what step 2 is asking in this code challenge. Is a relative server path the same as a root-relative path? If not, what is the difference?

Thanks in advance!

1 Answer

A root-relative path begins with a forward slash and it's a path to a file relative to where the site root is.

A relative path is the path to a file relative to the file that you're currently in.

So if your index.php is here: htdocs/about/leadership/index.php

And you need to include this file here: htdocs/config/company.php

You have to think about the path you would have to take in order to get from "index.php" to "company.php"

Hint: You need to know how to go up a level in the directory structure.