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 Moving the Other Pages

Difference between base url and root path command

Hello all,

It may be an odd question but when should i use base url command and when should i use root path command. I mean how do i know what to use and when, i see that sometimes we are using the relative directory to locate the page. Please help.

1 Answer

B B
B B
2,934 Points

base_url is generally going to be used when you are doing front end stuff like linking images/css/js etc. So when you are creating webpages that is generally the most used one in my experience.

root path will be used to reference the path to your web server, so if you were going to be uploading files/including php files, or handling things on server side you would be more likely to reference the root path.