# Enable mod_rewrite
<IfModule mod_rewrite.c>
    RewriteEngine On

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

    # Otherwise, forward the request to index.php
    RewriteRule . index.php [L]
</IfModule>

# Deny access to .htaccess itself
<Files .htaccess>
    Order Allow,Deny
    Deny from all
</Files>

# Protect includes directory
<Directory "includes">
    Order Allow,Deny
    Deny from all
</Directory>

# Protect private directory
<Directory "private">
    Order Allow,Deny
    Deny from all
</Directory>

# Deny access to logs directory
<Directory "logs">
    Order Allow,Deny
    Deny from all
</Directory>
