系统环境:Windows10 x64,Apache2.4 CGI/FastCGI,PHP5.6.37-NTS-x86
问题表现:访问没有.htaccess伪静态配置的项目,正常;带有.htaccess伪静态配置的项目,只能访问.html,.txt等文件,PHP无法执行,提示403,Forbidden
查看错误日志,提示信息如下:
Options FollowSymLinks and SymLinksIfOwnerMatch are both off, so the RewriteRule directive is also forbidden due to its similar ability to circumvent directory restrictions
解决方案:增加FollowSymLinks到cgi配置区块中,如下:
<Files ~ “\.php$”>
Options ExecCGI FollowSymLinks
AddHandler fcgid-script .php
FcgidWrapper “d:/php/php-cgi.exe” .php
</Files>
重置apache,正常。
https://stackoverflow.com/questions/11901993/options-followsymlinks-or-symlinksifownermatch-is-off