DocumentRoot in .htaccess is causing an error
-
02-07-2019 - |
Question
I have DocumentRoot /var/www/test in my .htaccess file. This is causing the apache server to give me a 500 internal server error.
The error log file shows: alert] [client 127.0.0.1] /var/www/.htaccess: DocumentRoot not allowed here
AllowOveride All is set in my conf file.
Any idea why this is happening?
Solution
The DocumentRoot directive cannot appear in a .htaccess
file. Put it in httpd.conf
instead.
OTHER TIPS
DocumentRoot should be set in your VirtualHost directive, not your .htaccess file.
Any specific reason you put DocumentRoot in your .htaccess file?
You don't mention your apache version , but docs for 2.0 say that DocumentRoot is only valid for virtualhost or server config. Acording to the docs it should not be used in a .htacces