A friend of mine has changed his web hosting server, and since that moment one of it's web pages stopped showing. The page displayed instead was a generic page from the Apache web server, telling that there was an internal error and to check the logs.
Here's a line from the log:
[Tue Aug 25 17:07:39 2009] [alert] [client xx.xx.xx.xx] /usr/local/www/htdocs/.htaccess: RewriteEngine not allowed hereI tried to find the answer on the net, and after a short google search and after reading a little bit of apache docs, I found the answer.
How this appeared?
My friend's web site includes a file called .htaccess, which usually is populated with directives for the apache web server. In a default apache setup, this file is read on web page access, but only if the main configuration directives (from httpd.conf or vhost configuration file) allow this. This is specified by the 'AllowOverride AuthConfig' directive. Since I've seen the error, AllowOverride AuthConfig was 'On', so the .htaccess file was processed, but some of it's content is not permitted in this context.
How to allow RewriteEngine on directive in .htaccess
All I needed to do is to modify the apache configuration file referring to htdocs directory. In my case it was the virtual host definition file, but it may be the main apache config file, httpd.conf. I've changed the <directory> section from
Allow from all
And it fixed the problem.<Directory /path/to/htdocs/>
AllowOverride AuthConfig FileInfo
Allow from all