4

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

错误日志文件显示:alert] [client 127.0.0.1] /var/www/.htaccess: DocumentRoot not allowed here

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

知道为什么会这样吗?

4

3 回答 3

12

DocumentRoot指令不能出现在文件.htaccess中。而是把它放进去httpd.conf

于 2008-09-27T01:00:11.467 回答
1

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

您将 DocumentRoot 放在 .htaccess 文件中的任何具体原因?

于 2008-09-27T01:00:57.953 回答
0

您没有提及您的 apache 版本,但 2.0 的文档说 DocumentRoot 仅对虚拟主机或服务器配置有效。根据文档,它不应在 .htacces 中使用

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

于 2008-09-27T01:01:59.650 回答