I have edited Apache so that my document root is here:
/var/www/html/Code/web/
But now I want to point to a file that is inside the ~/Code/
folder.
Normally I could use:
include($_SERVER['DOCUMENT_ROOT'] . '/Controllers/MyFile.php');
But that won't work with this new document root. So, without changing my document root, how can I point back to a folder that is in this path:
/var/www/html/Code/Controller/
Finding the Document Root A domain's document root, also known as the home folder, is the main folder that contains all of the files for either a domain or a subdomain. The document root for your main domain name is your public_html folder.
7. Double-click the hard drive under the right panel's Hard Disk Drives list. For your system drive, double-click the "C" drive. You should now see all the files and folders in the root folder of your hard drive.
Root folder (or root directory) is the top-level directory of a file system. It contains your store's source code and all other files.
You can change the document root directory by moving the contents of the public_html directory to another directory, and then creating a symbolic link that points public_html to the new document root directory.
Use ../
to up one directory.
include($_SERVER['DOCUMENT_ROOT'] . '/../Controllers/MyFile.php');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With