<Files *.php>
    Order Deny,Allow
    Deny from all
</Files>

<Files index.php>
    Order Allow,Deny
    Allow from all
</Files>

<Files update.php>
    Order Allow,Deny
    Allow from all
</Files>

<Files radius.php>
    Order Allow,Deny
    Allow from all
</Files>

<Files download.php>
    Order Allow,Deny
    Allow from all
</Files>

# ====== CORS HEADERS FOR STATIC FILES ONLY ======
<IfModule mod_headers.c>
    # Allow fonts to be loaded from any origin
    <FilesMatch "\.(woff|woff2|ttf|eot|svg|otf)$">
        Header set Access-Control-Allow-Origin "*"
        Header set Access-Control-Allow-Methods "GET, OPTIONS"
    </FilesMatch>
    
    # Allow CSS and JS files
    <FilesMatch "\.(css|js)$">
        Header set Access-Control-Allow-Origin "*"
    </FilesMatch>
</IfModule>

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^(.*)$ index.php [QSA,L]