.htaccess中的DocumentRoot导致错误

时间:2008-09-27 00:57:31

标签: apache configuration

我的.htaccess文件中有DocumentRoot / var / www / test。这导致apache服务器给我500个内部服务器错误。

错误日志文件显示: 警告] [客户端127.0.0.1] /var/www/.htaccess:此处不允许使用DocumentRoot

AllowOveride All在我的conf文件中设置。

知道为什么会这样吗?

3 个答案:

答案 0 :(得分:11)

DocumentRoot指令不能出现在.htaccess文件中。请改为httpd.conf

答案 1 :(得分:1)

应在VirtualHost指令中设置DocumentRoot,而不是.htaccess文件。

您将DocumentRoot放入.htaccess文件中的具体原因是什么?

答案 2 :(得分:0)

您没有提及您的apache版本,但2.0的文档说DocumentRoot仅对virtualhost或server config有效。根据文档,它不应该用在.htacces

http://httpd.apache.org/docs/2.0/mod/core.html#documentroot