Apache Does Not Follow Symlinks on Windows 403 Forbidden
I Found Many Similar Questions but Only for Linux and They Did Not Solve My Problem. What I Do Is: Serveradmin Webmaster@Localhost Servername Coreshop_Demo...
I found many similar questions but only for Linux and they did not solve my problem. What I do is:
<VirtualHost *:80 *:443>
ServerAdmin webmaster@localhost
ServerName coreshop_demo.local
DocumentRoot "D:/creation/software developer/projects/2021-coreshop-payment/web"
<Directory />
Options Indexes FollowSymlinks MultiViews
Require all granted
AllowOverride all
</Directory>
ErrorLog logs/coreshop_demo.local/error.log
CustomLog logs/coreshop_demo.local/access.log combined
LogLevel warn
AddHandler application/x-httpd-php .php
AddType application/x-httpd-php .php .html
php_value display_errors "Off"
php_value display_startup_errors "Off"
php_value log_errors "On"
</Virtualhost>
I make my symlinks with something like D:\creation\software developer\projects\2021-coreshop-payment\web\bundles> mklink /D "pimcorecore" "../../vendor/pimcore/pimcore/bundles/CoreBundle/Resources/public/, so the ../../vendor is not in the web directory.
When I try to access the files I got 403 forbidden with PHP error log something like invalid file or directory path syntax with Apache error code: AH00127.
Any idea how to fix this?
1 Answer
I guess the problem that the vendor directory is not inside the document root and there is some sort of bug inside Apache, which does not allow access to it. I cannot do much about it, I rather use a workaround. I removed the symlinks and added Alias to the virtualhost config.
<VirtualHost *:80 *:443>
ServerAdmin webmaster@localhost
ServerName coreshop_demo.local
DocumentRoot "D:/creation/software developer/projects/2021-coreshop-payment/web"
<Directory />
Options Indexes FollowSymlinks MultiViews
Require all granted
AllowOverride all
</Directory>
Alias "/bundles/pimcoreadmin" "D:/creation/software developer/projects/2021-coreshop-payment/vendor/pimcore/pimcore/bundles/AdminBundle/Resources/public/"
ErrorLog logs/coreshop_demo.local/error.log
CustomLog logs/coreshop_demo.local/access.log combined
LogLevel warn
AddHandler application/x-httpd-php .php
AddType application/x-httpd-php .php .html
php_value display_errors "Off"
php_value display_startup_errors "Off"
php_value log_errors "On"
</Virtualhost>