すべて .htaccess パスワードで保護された CI プロジェクトがあります。.htaccess パスワード保護は、ルート フォルダーから設定されます。ただし、モバイル アプリに API を提供するため、モバイルがその特定のコントローラーと通信できるように、その目的のために特定のコントローラーを保護解除する必要があります。
それを行う最良の方法は何ですか?
ルートフォルダーにあるメインの .htaccess に以下を追加してみました。
<Files "/home/path/to/project/root/my_specific_controller">
Allow from all
Satisfy any
</Files>
また、次の.htaccessをコントローラーフォルダー自体に配置しようとしました。
<Files "my_specific_controller"> # this is the name of my CodeIgniter controller
Allow from all
Satisfy any
</Files>
この 2 つのどちらも機能しません。助けてくれてありがとう。
ルート フォルダーにあるメインの .htaccess ファイルは次のようになります。
RewriteEngine On
RewriteBase /project/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)$ index.php/$1 [L]
RewriteRule ^(.*)$ index.php/$1 [L]
<Files "/home/path/to/project/root/my_specific_controller">
Allow from all
Satisfy any
</Files>
AuthType Basic
AuthName "Pswd Protected Area"
AuthUserFile /home/path/to/project/root/.htpasswd
Require valid-user