認証されたユーザーのみがサイトを表示できるようにするために、次の .htaccess を持つ KISSMVC php ベースのサイトがあります。
RewriteEngine On
RewriteBase /myphpsite/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [L]
# Protect app files
RewriteRule ^((app|system|scripts).*)$ index.php/$1 [L]
AuthName "Please enter your username and password"
AuthType Basic
<Limit GET>
require user THEUSERNAME
</Limit>
これは問題なく動作します。
問題は、クライアントが認証なしでサイトから値を取得できるようにしたいことです。この値はクライアントごとに計算されるため、index.php 関数を介して取得されます。さらに、これらの値が格納されるフォルダー構造はありません。
例として、この URL はプロンプトを表示しません。
http://fancywebsite.com/myphpsite/index.php/inventory/hash/variable
しかし、これはまだプロンプトを表示する必要があります:
http://fancywebsite.com/myphpsite
要求された URL に「index.php/inventory/hash」が含まれている場合に、.htaccess ファイルで認証をバイパスまたは満たすように指定できれば、完璧です。