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

Can't figure this out, tried all possible combos and not getting it.

wants relative path from one folder to another.

5 Answers

Kevin Korte
Kevin Korte
28,148 Points

Are you trying to do question #2?

Question one is asking for a root-relative path which is what Peter posted. Question two is asking for a relative path.

The answer to question is you have to use a php include, and you have to go back down to folders, and than go into two folder structures to find the file it wants include.

Peter Ramsing
Peter Ramsing
16,814 Points

Just for kicks, here's question #2.

<?php require_once($_SERVER["DOCUMENT_ROOT"] . "../../config/company.php"); ?>

I tried No Slash, Just slash, Dot slash and Dot Dot slash. None worked, so I'd really like to know what the answer is. Thanx!

Peter Ramsing
Peter Ramsing
16,814 Points

Give this a go:

<p><a href="/contact/">Contact</a></p>