Apache RewriteEngine On causes a 403 error

I have a Linux box working with Centos 6.6 with Apache 2.2.x For some unknown reason, enabling the rewrite mechanism causes a 403 error (this happens if I add a rewrite rule or not).

I spent several hours studying this and made changes to my configuration in accordance with the tips that I found in many places, but still did not get anywhere.

Currently in my .htaccess I have this:

<IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On </IfModule> 

In the directives for the virtual host, I have the following:

 DocumentRoot /var/www/html/example.uk <Directory /var/www/html/example.uk> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> ServerName example.uk ServerAlias www.example.uk 

(This seems to work on Debian, but not on my Centos machine.)

In my httpd.conf I changed

AllowOverride None

to

AllowOverride All

my httpd.conf also contains LoadModule rewrite_module modules/mod_rewrite.so

The error log says:

The FollowSymLinks or SymLinksIfOwnerMatch parameters are disabled, which means that the RewriteRule directive is disabled: /var/www/html/example.uk

Now I have added SymLinksIfOwnerMatch directives to the directives, but this did not solve the problem.

I followed this , and everything seemed to go as it should.

+8
linux apache .htaccess mod-rewrite centos6
source share
3 answers

Since the apache directive version> = 2.4

 Order allow,deny allow from all 

leads to global 403 to make sure if you check that you are using the apache log:

[Tue May 05 11: 54: 32.471679 2015] [authz_core: error] [pid 9497] [client 127.0.0.1:35908] AH01630: the client refused the server configuration: / path / to / web /

Order commentary directive and add Require all granted as below:

  Require all granted #Order allow,deny #allow from all 

I hope for this help.

Edit:

explanation from apache This behavior is provided by the new module mod_authz_host

List of available restrictions (ip, host, etc.) http://httpd.apache.org/docs/2.4/en/mod/mod_authz_host.html

+2
source share

You must remove this line from htaccess

 Options +FollowSymLinks 

You already have an apache vhost file. Also, if you have to add a rule, if you are going to enable mod_rewrite or it makes no sense to include it.

+1
source share

This happens when Apache does not have execute rights for

 /var /var/www /var/www/html /var/www/html/example.uk 

Run:

 chmod o+x /var /var/www /var/www/html /var/www/html/example.uk 
+1
source share

All Articles