.htaccess: RewriteEngine not allowed here

Viewed 86518

I uploaded the .htaccess to the server and received an Error 500 (Internal Server Error).

And in the error log I had the following error:

.../.htaccess: RewriteEngine not allowed here

But mod_rewrite.so is enabled.

So, do I need to change

<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>

to

<Directory />
    Options FollowSymLinks
    AllowOverride All
</Directory>

in the /etc/httpd/conf/httpd.conf file?

Or could it be something else? The .htaccess file should be okay, because it works perfectly fine on my localhost. I just don't want to screw anything up.

Here's part of my .htaccess file:

Options All -Indexes

Options +FollowSymLinks

RewriteEngine On
8 Answers

I was getting this type of error from the Google Cloud instance after checking the logs from the /var/log/apache2/error.log

.htaccess: RewriteEngine not allowed here

To get rid of the above error & 500 Internal Server Error, follow these simple steps

sudo nano /etc/apache2/apache2.conf

Then add these snippets of lines

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>

After you’ve made that change, make sure to restart the server:

sudo service apache2 restart

This worked for me in getting rid of 500 Internal Server Error hosted on Google Cloud instance

Related