# Apache 重写与安全规则（盘云CMS）
Options -Indexes

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    # 禁止直接访问敏感目录
    RewriteRule ^(config|core|app|storage|docs)/ - [F,L]
    RewriteRule ^(themes|plugins)/.+\.(php|phtml|phar|html)$ - [F,L]
    RewriteRule ^(uploads)/.+\.(php|phtml|phar)$ - [F,L]

    # 静态文件直接返回，其余交给入口
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^ index.php [L]
</IfModule>

<IfModule mod_authz_core.c>
    <FilesMatch "\.(env|ini|log|sql|lock)$">
        Require all denied
    </FilesMatch>
</IfModule>

<IfModule !mod_authz_core.c>
    <FilesMatch "\.(env|ini|log|sql|lock)$">
        Order allow,deny
        Deny from all
    </FilesMatch>
</IfModule>
