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
Toby Hines
5,038 PointsAren't ROOT_PATH and BASE_URL the same thing?
When we are defining the constants ROOT_PATH and the BASE_URL they appear, to me, to do the same thing which is take you to the root of the server.
define("BASE-URL", "/");
and
define("ROOT_PATH", $_SERVER["DOCUMENT_ROOT"] . "/");
I do not get where the difference is as both will put you at the same place and in the examples, Randy uses ROOT_PATH to get to the include file for the headers then the BASE_URL to get to the img file, both of which are subdirectories located in the same folder
1 Answer
Michael De Marre
14,198 PointsBase-URL is referring to the domain path when a user is browsing your website on the client side. ROOT_PATH refers to the actual file path of your files on the server. When you upload your files to a hosting server, you will not know the exact file path.
Base-URL: mycooldomain.com
ROOT_PATH: C:/some_folder/some_folder/htdocs/