我的 .htaccess 文件中有 DocumentRoot /var/www/test 。这导致 apache 服务器给我一个 500 内部服务器错误。
错误日志文件显示:alert] [client 127.0.0.1] /var/www/.htaccess: DocumentRoot not allowed here
AllowOveride All 在我的 conf 文件中设置。
知道为什么会这样吗?
我的 .htaccess 文件中有 DocumentRoot /var/www/test 。这导致 apache 服务器给我一个 500 内部服务器错误。
错误日志文件显示:alert] [client 127.0.0.1] /var/www/.htaccess: DocumentRoot not allowed here
AllowOveride All 在我的 conf 文件中设置。
知道为什么会这样吗?
DocumentRoot指令不能出现在文件.htaccess中。而是把它放进去httpd.conf。
DocumentRoot 应该在您的 VirtualHost 指令中设置,而不是在您的 .htaccess 文件中。
您将 DocumentRoot 放在 .htaccess 文件中的任何具体原因?
您没有提及您的 apache 版本,但 2.0 的文档说 DocumentRoot 仅对虚拟主机或服务器配置有效。根据文档,它不应在 .htacces 中使用