Options -MultiViews
RewriteEngine On

# If file or directory exists, serve it directly
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

# Handle admin routes - redirect to admin subpath if accessing root admin
RewriteRule ^admin/?$ admin/ [R=301,L]

# For all other requests within admin path, serve index.html (SPA routing)
RewriteRule ^ index.html [L]