# Apache Configuration for Admin Panel

# Enable Rewrite Engine
<IfModule mod_rewrite.c>
    RewriteEngine On
    
    # Redirect to login.php if no file/directory exists
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^ login.php [L]
</IfModule>

# Set default index files
DirectoryIndex login.php index.php index.html

# Prevent directory listing
Options -Indexes

# Allow access to PHP files only
<FilesMatch "\.php$">
    Require all granted
</FilesMatch>

# Deny access to other files
<FilesMatch "\.(json|xml|md|txt)$">
    Require all denied
</FilesMatch>
