21

次の.htaccess値を使用してphpベースのアプリケーションをホストしようとしています。

Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php

RewriteEngine On
RewriteBase /easydeposit
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

しかし、私は次の2つのエラーに直面し続けています。

[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

なぜこれが起こっているのかわかりません。どんな助けでも大歓迎です。

4

8 に答える 8

57

最近、バージョン 2.2 よりも新しいバージョンの Apache にアップグレードした場合、タグ内の httpd.conf または httpd-vhosts.conf ファイルから authz_core エラー エラーが発生している可能性があり<Document>ます。mod_authz_core は Apache 2.3 で導入され、アクセス制御の宣言方法が変更されました。

したがって、たとえば、2.2 の構成方法の代わりに<Directory>...

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

OrderおよびAllowディレクティブはRequireディレクティブに置き換えられました。

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

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

于 2012-11-06T19:32:23.507 に答える
4

この質問/回答により、私が感謝しているドキュメントにたどり着きました。次の方法で解決しました。

前の.htaccessファイル:

# 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

この構成では、次のようなエラーが発生していました。

[Thu Dec 08 10:29:20.347782 2016] [access_compat:error] [pid 2244:tid 15876] [client 93.93.93.93:49340] AH01797: サーバー構成によってクライアントが拒否されました: C:/path/to/index.php

2.4 構成用に更新

# 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
于 2016-12-08T16:52:24.563 に答える
2

これがあなたのhtaccessファイルと関係があるとは思えません。エラーは、、、、、およびディレクティブを提供するmod_access_compatによってスローされます。どこかで、許可と拒否の設定が間違っている可能性があります。最後の.htaccessエラーは、mod_authz_coreによるものであるため、.htaccessファイルへのアクセスを完全にブロックする何かがアップストリームにある可能性があります。AllowDenyOrderSatisfy

于 2012-08-27T17:16:43.533 に答える
0
Options +FollowSymLinks
Options -Indexes

多くの共有ホスティングでは、上記のコードが主な問題になることがよくあります

于 2012-08-27T11:02:14.563 に答える
0

また、apache ユーザー (おそらく _www) がディレクトリ ( /home/abc/opt/apache/htdocs/xyz/) にアクセスできると確信していますか?

于 2012-08-27T11:08:46.203 に答える
0

.htaccess ファイルのオプションを上書きすることが許可されていますか? これについては、メインのApache構成ファイルを確認してください

于 2012-08-27T10:53:50.977 に答える
0

別の例として、次のように書き直します。

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

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

使用して

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

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

于 2013-11-18T05:51:21.453 に答える