Hi there, I'm trying to get the root directory of my site... But I don't want to edit the dots with slashes every time I make a new page in a directory inside another directory.. Any ideas? Here's an example tree :-)

-/
-/stuff
--/stuff/lol.php
-/lolwut
--/lolwut/cake.php
--/lolwut/pie.php

Recommended Answers

All 2 Replies

$_SERVER will give you the root address.

Hmm.. It appears that didn't work, so I used $_SERVER["SERVER_NAME"], and it started working! Anyway, thanks for the help :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.