Reputation: 262
In my config.php I defined the root folder as
define('ROOT_DIR', str_replace('\\', '/', realpath(dirname(__FILE__) . '../')) . '/');
which is
c:/xampp/htdocs/myWebsite/
For security purpose I moved my config.php file outside the root and placed it on a folder config.
The problem is, now the root_dir which was earlier
c:/xampp/htdocs/myWebsite
becomes
c:/xampp/htdocs/config /
How do I keep the config.php where it is now (after moving it away from the root) and yet have the root folder be/shown as
c:/xampp/htdocs/myWebsite/
Upvotes: 0
Views: 179
Reputation: 262
After lots of hit and try I finally used this code of line to define my ROOT DIR this way
define('ROOT_DIR', str_replace('\', '/', realpath(dirname(FILE) . '/../')).'/public_html/', false );
it seems to be working fine on a live server.
Upvotes: 0
Reputation: 5071
Check if this works:
define('ROOT_DIR',$_SERVER['DOCUMENT_ROOT'] . "/myWebsite/");
Upvotes: 1