.htaccess中的DocumentRoot导致错误
-
02-07-2019 - |
题
我的.htaccess文件中有DocumentRoot / var / www / test。这导致apache服务器给我500个内部服务器错误。
错误日志文件显示: 警告] [客户端127.0.0.1] /var/www/.htaccess:此处不允许使用DocumentRoot
AllowOveride All在我的conf文件中设置。
知道为什么会这样吗?
解决方案
DocumentRoot 指令无法出现在中.htaccess
文件。把它放在 httpd.conf
中。
其他提示
应在VirtualHost指令中设置DocumentRoot,而不是.htaccess文件。
您将DocumentRoot放入.htaccess文件中的具体原因是什么?
您没有提及您的apache版本,但2.0的文档说DocumentRoot仅对virtualhost或server config有效。根据文档,它不应该用在.htacces
中http://httpd.apache.org/docs/2.0 /mod/core.html#documentroot
不隶属于 StackOverflow