# BEGIN ppp

# ディレクトリ一覧表示を無効化
Options -Indexes

# .db ファイルへのアクセス拒否
<FilesMatch "\.db$">
    Require all denied
</FilesMatch>

# .env や設定系ファイルの保護
<FilesMatch "^\.env|\.ini|\.log|\.config$">
    Require all denied
</FilesMatch>

# ---------------------------------
# Rewriteルール
# ---------------------------------

<IfModule mod_rewrite.c>
    RewriteEngine On
    
    RewriteRule ^(env|core)/ - [F,L]
      
    # themes 配下の PHP 実行禁止
    RewriteRule ^themes/.*\.php$ - [F,L]

    # 実在するファイル・ディレクトリはそのままアクセス許可
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    # それ以外は index.php に転送
    RewriteRule ^ index.php [L]
</IfModule>
# END ppp