I am on a shared hosting package on a LAMP stack with no shell access.
I can create symlinks using PHP's symlink()
function.
Let's say my web root is /home/www/user1/public
Let's say I have a real directory named /home/www/user1/public/real_dir
And I create a symlink named /home/www/user1/public/fake_dir
pointing to real_dir
Why would I get a 403 Forbidden when trying to access www.mydomain.com/fake_dir
but not when trying to access www.mydomain.com/real_dir
?
It shouldn't be a rights problem because when I create a file in PHP, I can access that all right.
I tried switching FollowSymlinks
off and on in .htaccess (it was on), but no luck.
Could it be that FollowSymlinks
is defined as not overwritable in a .htaccess file? Or is there something else to be aware of when working with Symlinks in Apache?
Apache has to be configured to allow access to the directory on the filesystem. This has to be done by a system administrator by inserting a <Directory> directive in the apache configuration files (httpd.conf).
Since the real directory is inside the web root it must be accessible, but FollowSymLinks may not have been enabled for the directory - this also has to be added to the <Directory> directive.
See http://httpd.apache.org/docs/2.0/mod/core.html#directory
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