linux - Apache RewriteEngine On causes 403 error -
i have linux box running centos 6.6 apaches 2.2.x unknown reason, turning on rewrite engine causes 403 error (this happens whether add rewrite rule or not).
i have spent hours researching , have made changes config in accordance advice have found in many places, still got nowhere.
currently in .htaccess have this:
<ifmodule mod_rewrite.c> options +followsymlinks rewriteengine on </ifmodule>
in directives virtual host, have this:
documentroot /var/www/html/example.uk <directory /var/www/html/example.uk> options indexes followsymlinks multiviews allowoverride order allow,deny allow </directory> servername example.uk serveralias www.example.uk
(this seems work in debian box, not centos machine.)
in httpd.conf have changed
allowoverride none
to
allowoverride
my httpd.conf contains loadmodule rewrite_module modules/mod_rewrite.so
error log says:
options followsymlinks or symlinksifownermatch off implies rewriterule directive forbidden: /var/www/html/example.uk
now, have added symlinksifownermatch directives, didn't solve problem.
i followed this , seemed go should.
since apache version >= 2.4 directive
order allow,deny allow
leads global 403, ensure if check you're apache's log :
[tue may 05 11:54:32.471679 2015] [authz_core:error] [pid 9497] [client 127.0.0.1:35908] ah01630: client denied server configuration: /path/to/web/
comment directive order
, add require granted
bellow:
require granted #order allow,deny #allow
hope help.
edit :
explanation apache behaviour provided new module mod_authz_host
for list of restriction available (ip, host, etc) http://httpd.apache.org/docs/2.4/en/mod/mod_authz_host.html