DirectoryIndex index.html
Options -MultiViews

RewriteEngine On
RewriteBase /

# If requested path is a file or directory that exists, serve it
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

# If it's a directory with an index.html, serve that index.html
# This handles the case where /about is requested and about/index.html exists
RewriteCond %{DOCUMENT_ROOT}/$1/index.html -f
RewriteRule ^(.*)$ $1/index.html [L]

# Fallback to the main index.html for everything else (SPA)
RewriteRule ^ index.html [L]

# Error handling
ErrorDocument 404 /index.html
