How to restrict access to the files outside document root in apache?
- by Bakhtiyor
I have virtual hosts in /var/www/site1 and /var/www/site2 folders. I want to restrict access to the files outside document root in apache virtual host, i.e. site1 could not access files of site2.
Right now this scripts in /var/www/site1 works fine, which is not good:
$filename = "/var/www/site2/somefile";
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
echo $contents;
How to solve this problem please?
Thank you very much!