# Enable Rewrite Engine
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    # Allow access to static files (files or directories that exist)
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]

    # Prevent direct access to index.html
    RewriteRule ^index\.html$ - [L]

    # Redirect all non-static requests to index.html (client-side routing)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^ /index.html [L]
</IfModule>

# Set proper caching for static assets
<IfModule mod_headers.c>
    <FilesMatch "\.(js|css|json|html|ico|svg|woff2?|ttf|eot|otf|png|jpg|jpeg|gif|webp)$">
        Header set Cache-Control "public, max-age=31536000"
    </FilesMatch>
</IfModule>

ErrorDocument 404 /index.html

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php81” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php81 .php .php8 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
