DocumentRoot in .htaccess causes error

I have DocumentRoot / var / www / test in my .htaccess file. This causes the Apache server to give me 500 internal server errors.

The error log file shows: alert] [client 127.0.0.1] /var/www/.htaccess: DocumentRoot is not allowed here

AllowOveride All is installed in my conf file.

Any idea why this is happening?

+4
source share
3 answers

The DocumentRoot directive cannot be displayed in a .htaccess file. Instead, put it in httpd.conf .

+11
source

DocumentRoot should be installed in your VirtualHost directive, and not in the .htaccess file.

Any specific reason you put DocumentRoot in your .htaccess file?

+1
source

You did not mention your version of apache, but docs for 2.0 say that DocumentRoot is only valid for virtual host or server configuration. According to docs, it should not be used in .htacces

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

0
source

Source: https://habr.com/ru/post/1277242/


All Articles