# SECURE AND ROUTE CONFIGURATION FOR FOLLOWERS PANEL
# AUTO-GENERATED BY BUNDLER BUILD SYSTEM

# 1. Deny access to JSON files and database files
<Files "*.json">
    Order Allow,Deny
    Deny from all
</Files>

# 2. Deny access to config.php or installer backups
<Files "config.php">
    Order Allow,Deny
    Deny from all
</Files>

# 3. Apache URL Rewriting Engines
RewriteEngine On

# Avoid rewrite loop for api.php itself
RewriteCond %{REQUEST_URI} ^/api\.php [NC]
RewriteRule ^ - [L]

# Route all /api/* requests to our api.php file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^api/(.*)$ api.php?route=$1 [QSA,L]

# Route all other visitor page requests to index.html for React SPA
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.html [L]
