views:

3414

answers:

3

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?

+3  A: 

The DocumentRoot directive cannot appear in a .htaccess file. Put it in httpd.conf instead.

Greg Hewgill
or a specified VirtualHost file
Nick Sergeant
This is what happens when you stay up in the early hours of the morning (uk time here) working on technical problems. You get sloppy. Thanks for the kick up the arse.
A: 

DocumentRoot should be set in your VirtualHost directive, not your .htaccess file.

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

Nick Sergeant
A: 

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

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

Dprado