Setting A Root Directory For Accessing Files From Subfolders?
Solution 1:
$_SERVER['DOCUMENT_ROOT']
gives you the real file-system path, not the path returned by Apache.
To link to the resource you need to use the HTTP path. If you want to link from the root you just need something like /images/logo.jpg
Solution 2:
I found that on my PHPBB3.1
driven website using the "Pages" addin, the relative link would not remain 'static' in some link buttons at the top of my site.
From the PHPbb3
index page a link such as app.php/page/FT would produce an address of http://earth/forum/app.php/page/FT
(Correct) ,but from the "Pages add in) that same link produced http://earth/forum/app.php/page/app.php/page/FT
(incorrect).
I started looking for a way to set my page relative to the root of the web. I could NOT use absolute links because my site is replicated on other servers. I found the answer by trial and error. Simply add several ../../../ like this ../../../forum/app.php/page/FT and it works.
Perhaps not the best of computer programming but it does the job. In a nutshell with each ../ you step back a directory, put too many in and it goes back to the root but cannot go back any further!
Post a Comment for "Setting A Root Directory For Accessing Files From Subfolders?"