user317005
user317005

Reputation:

.htaccess: RewriteEngine not allowed here

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

Upvotes: 39

Views: 90145

Answers (8)

Nɪsʜᴀɴᴛʜ ॐ
Nɪsʜᴀɴᴛʜ ॐ

Reputation: 2904

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

Upvotes: 0

Gpak
Gpak

Reputation: 3390

Try to change username.conf file on Mac under /etc/apache2/users/username.conf to

<Directory "/Users/akyoo/Sites/">
   AllowOverride All
   Options Indexes MultiViews FollowSymLinks
   Require all granted
</Directory>

My .htaccess file looks like this

#Allow from all
Options +FollowSymLinks
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

This works fine for me. Solution for Ubuntu users

Upvotes: 0

Glaucius Zacher
Glaucius Zacher

Reputation: 49

Just an idea, this happened to me, and I've lost a lot of time trying to solve it.

If you have a directory like d:/web/my-sites/some-site/

And you place the .htaccess on d:/web/my-sites/some-site/.htaccess (where it supposed to be).

If you have ANY .htaccess files before this directory, Apache reads that files, and blocks the execution of the entire path, producing an internal server error.

I.E.: You have d:/web/my-sites/.htaccess

Upvotes: 4

Aaron Lifshin
Aaron Lifshin

Reputation: 225

Also, just make sure you are editing the correct config file. I had created a file under /etc/apache2/users/USERNAME.conf but was editing /etc/apache2/httpd.conf.

Removing the USERNAME.conf file worked.

Upvotes: 0

P. Sharma
P. Sharma

Reputation: 31

In httpd version 2.4 (2.4.3 and 2.4.4), take a look at /etc/httpd/conf.d/wordpress.conf There is one entry for: ....

Change: "AllowOverride Options" to "AllowOverride All"

in wordpress.conf also in addition to changing httpd.conf. Restart the http server before the changes will take effect.

Upvotes: 3

Jacek Kaniuk
Jacek Kaniuk

Reputation: 5229

minimum configuration for your .htaccess to work:

AllowOverride FileInfo Options

allowing all configuration will work as well:

AllowOverride All

Upvotes: 61

anubhava
anubhava

Reputation: 785128

Let's say your DOCUMENT_ROOT is /home/foo/web then have this config in your httpd.conf file:

<Directory "/home/foo/web">
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

This should take care of RewriteEngine is not allowed error you're getting.

Upvotes: 9

linuxeasy
linuxeasy

Reputation: 6499

you could use something like this in your .htaccess file:

RewriteEngine on
RewriteCond $1 !^(index\.php|html|test)
RewriteRule ^(.*)$ /index.php/$1 [L]

this code simply means, that anything not pointing to index.php or html or test should be directed to index.php!

Hope this is helpful!

Upvotes: -4

Related Questions