# ==============================================================================
# Apache Configuration for the Public Directory
# ==============================================================================

# --- Prevent Directory Listing ---
# Disables the server from showing a list of files if a directory is accessed directly.
Options -Indexes

# --- Security: Block Direct Access to Theme PHP Files ---
# This is a critical security rule. It prevents anyone from directly accessing
# .php files within the themes directory. All requests must go through the
# main index.php front controller.
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^themes/.*\.php$ - [F,L]
</IfModule>

# --- Performance: Browser Caching for Assets ---
# Instructs the user's browser to cache static files like CSS, JS, and images
# for a long period (e.g., 1 month). This significantly improves loading speed
# for returning visitors.
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/css "access plus 1 month"
    ExpiresByType application/javascript "access plus 1 month"
    ExpiresByType image/jpeg "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/svg+xml "access plus 1 month"
    ExpiresByType image/webp "access plus 1 month"
    ExpiresByType image/x-icon "access plus 1 year"
</IfModule>
