<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    # If the file or directory exists, serve it directly
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    # Otherwise, route to index.php
    RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

# Security: Deny access to sensitive files
<FilesMatch "^\.">
    Order allow,deny
    Deny from all
</FilesMatch>

<FilesMatch "config\.php">
    Order allow,deny
    Deny from all
</FilesMatch>

# Disable directory listing
Options -Indexes

# Set default charset
AddDefaultCharset UTF-8
