私のhtaccessルールのほとんどは、署名されていないユーザーをにリダイレクトしindex.html
ます。
しかし、それらをにリダイレクトするとindex.html
、これらのルールはすべて、そのページに対しても再実行されます。インデックスファイルにアクセスするユーザーに対して、最小限のルールセットを実行する必要があります。
[L]
htaccessルールの実行を停止することは明らかです。
この問題のより良い方法は何でしょうか?これはそれを行うための適切な方法ですか、それともより良い推奨事項がありますか?
RewriteCond %{REQUEST_URI} index\.html
RewriteRule ^(.*)$ index.html [L]
私の完全なhtaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{REQUEST_URI} (\/onefolder|\/secondfolder) [NC]
RewriteCond %{REMOTE_ADDR} !111\.22\.33\.44 [NC]
RewriteCond %{REQUEST_URI} !(index\.html) [NC]
RewriteRule ^(.*)$ index.html [F]
RewriteCond %{HTTP_USER_AGENT} oneagent|otheragent [NC]
RewriteCond %{REQUEST_URI} !(index\.html) [NC]
RewriteRule ^(.*)$ index.html? [R=301,L]
RewriteCond %{HTTP_USER_AGENT} betteragent|otherbetterganet [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(index\.html) [NC]
RewriteRule ^(.*)$ index.html? [R=301,L]
RewriteCond %{HTTP_COOKIE} !username [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(\/importantone|\/somefolder|index\.html) [NC]
RewriteRule ^(.*)$ index.html [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>