I'm trying to host a php based application with the following .htaccess values.
Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine On
RewriteBase /easydeposit
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
However, I keep facing the following two errors,
[access_compat:error] [pid 25330:tid 27] AH01797: client denied by server configuration: /home/abc/opt/apache/htdocs/xyz/system/
[access_compat:error] [pid 25330:tid 27] AH01797: client denied by server configuration: /home/abc/opt/apache/htdocs/xyz/private/
[access_compat:error] [pid 25330:tid 27] AH01797: client denied by server configuration: /home/abc/opt/apache/htdocs/xyz/application/
[authz_core:error] [pid 25330:tid 27] AH01630: client denied by server configuration: /home/abc/opt/apache/htdocs/xyz/.htaccess
I'm not sure why this is happening. Any help is appreciated.
In your browser, open /test , with the correct domain name. So, it should look like http://localhost/test or http://example.org/test . If you see the following, it works!
The <IfModule mod_rewrite. c>... </IfModule> block ensures that everything contained within that block is taken only into account if the mod_rewrite module is loaded. Otherwise you will either face a server error or all requests for URL rewriting will be ignored.
htaccess rewrite rule includes setting a combination of rewrite condition ( RewriteCond ) tests along with a corresponding rule ( RewriteRule ) if the prior conditions pass. In most cases, these rules should be placed at any point after the RewriteEngine on line in the . htaccess file located in the website's docroot.
There are two main directive of this module: RewriteCond & RewriteRule . RewriteRule is used to rewrite the url as the name signifies if all the conditions defined in RewriteCond are matching. One or more RewriteCond can precede a RewriteRule directive.
If you have recently upgraded to a version of Apache greater than version 2.2, the authz_core error error might be coming from your httpd.conf or httpd-vhosts.conf file in the <Document>
tags. mod_authz_core was introduced in Apache 2.3 and changed the way that access control is declared.
So, for example, instead 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 have been replaced with the Require directive:
<Directory "C:/wamp">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Sources http://www.andrejfarkas.com/2012/06/fun-with-wamp-server-and-apache-2-4-2/ http://httpd.apache.org/docs/2.4/upgrading.html
This question/answer got me to the documentation for which I'm thankful, and the following was 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 was producing errors like:
[Thu Dec 08 10:29:20.347782 2016] [access_compat:error] [pid 2244:tid 15876] [client 93.93.93.93:49340] AH01797: client 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
I doubt this has anything to do with your htaccess file. The errors are thrown by mod_access_compat, which provides the Allow
, Deny
, Order
, and Satisfy
directives. Somewhere, you probably have your allow's and deny's configured wrong. As for the .htaccess error at the end, it's from mod_authz_core, so there may be something upstream that blocks access to .htaccess files outright.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With