[ACCEPTED]-Error with .htaccess and mod_rewrite-mod-rewrite

Accepted answer
Score: 57

If you have recently upgraded to a version 9 of Apache greater than version 2.2, the 8 authz_core error error might be coming from 7 your httpd.conf or httpd-vhosts.conf file 6 in the <Document> tags. mod_authz_core was introduced 5 in Apache 2.3 and changed the way that access 4 control is declared.

So, for example, instead 3 of the 2.2 way of configuring <Directory>...

    <Directory "C:/wamp">
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>

Order and Allow directives 2 have been replaced with the Require directive:

    <Directory "C:/wamp">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

Sources 1 http://www.andrejfarkas.com/2012/06/fun-with-wamp-server-and-apache-2-4-2/ http://httpd.apache.org/docs/2.4/upgrading.html

Score: 4

This question/answer got me to the documentation for 6 which I'm thankful, and the following was 5 what solved it for me.

Previous .htaccess file:

# password protection allowing multiple resources
AuthType Basic
AuthName "Restricted Area"
AuthUserFile C:\path\to\.htpasswd
AuthGroupFile /dev/null
Require valid-user

# allow public access to the following resources
SetEnvIf Request_URI "(path/to/public_files/.*)$" allow

# these lines must be updated

Order allow,deny
# Allowing an ip range:
Allow from 69.69.69
# Allowing another range:
Allow from 71.71.71

Satisfy any

This configuration 4 was producing errors like:

[Thu Dec 08 10:29:20.347782 3 2016] [access_compat:error] [pid 2244:tid 2 15876] [client 93.93.93.93:49340] AH01797: client 1 denied by server configuration: C:/path/to/index.php

updated for 2.4 configuration

# 7 lines unchanged...shown again for clarification 
AuthType Basic
AuthName "Restricted Area"
AuthUserFile C:\path\to\.htpasswd
AuthGroupFile /dev/null
Require valid-user
SetEnvIf Request_URI "(path/to/public_files/.*)$" allow

# these are the changes replacing:

# Order allow,deny
# Allow from <range>
# Satisfy any

Require ip 69.69.69
Require ip 71.71.71
Require all granted
Score: 2

I doubt this has anything to do with your 7 htaccess file. The errors are thrown by 6 mod_access_compat, which provides the Allow, Deny, Order, and Satisfy directives. Somewhere, you 5 probably have your allow's and deny's configured 4 wrong. As for the .htaccess error at the 3 end, it's from mod_authz_core, so there may be something 2 upstream that blocks access to .htaccess 1 files outright.

Score: 0

Are you sure that your are allowed to override 2 Options in your .htaccess file? check main 1 apache config file for this

Score: 0
Options +FollowSymLinks
Options -Indexes

on many shared hosting the above code often 1 the main problems

Score: 0

And you are absolutely sure that the apache 2 user (probably _www) has access to the directory 1 (/home/abc/opt/apache/htdocs/xyz/)?

Score: 0

Another example, rewrite from:

www.yoursite.com/script.php?product=123 

to

www.yoursite.com/cat/product/123/

using

RewriteRule cat/(.*)/(.*)/$ /script.php?$1=$2

http://w3webtutorial.blogspot.com/2013/11/htaccess-and-modrewrite-in-your-php.html

0

Score: 0

For me, there was an .htaccess file in the 3 wp-config folder that had these entries

Order deny,allow
Deny from all
<Files ~ ".(xml|css|jpe?g|png|gif|js)$">
Allow from all
</Files>

That 2 caused icons in the interface to show up 1 as squares.

More Related questions