2017-04-20 1 views
1

完全な/ var/www/html/*領域をパスワードで保護したいが、1つのファイルを除外したい。 私はこのコードを試してみました:.htaccessファイルが機能していません。

<Files *.*> 
AuthType Basic 
AuthName "Service-Login" 
AuthUserFile /path/tomypasswdfile/... 
Require valid-user 
</Files> 

<Files /index.alternetive.php> 
#Order allow,deny 
Require all granted 
#Allow from All 
#Allow from env=allow 
#Satisfy any 

</Files> 

ログインが機能しますが、「index.alternetive.php」 - ファイルを含むすべてのファイルのさ。

私のapache2はUbuntu-Xenial上で動作しています。

ありがとうございました

答えて

0

ファイル名は問題です。 index_alternetive.phpのようなものに変更してください。

1

Filesはパス名では機能しませんが、ファイル名でのみ機能します。特定のパスが必要な場合は、Directoryディレクティブで囲むか、それが所属する.htaccessに配置する必要があります。あなたの場合、これはルートディレクトリのようです。

AuthType Basic 
AuthName "Service-Login" 
AuthUserFile /path/tomypasswdfile/... 
Require valid-user 

<Files index.alternetive.php> 
Require all granted 
</Files> 

また、スペルを見てください。 alternetivealternative

関連する問題