ErrorDocument 404 /404.html

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /

  # Redirect Trailing Slashes matches if directory
  # Astro trailingSlash: 'always' means files are dir/index.html
  # So /blog/post/ works fine.

  # Simple fallbacks if needed, though mostly standard Apache handles DirectoryIndex
  DirectoryIndex index.html

  # Redirect to correct trailing slash if needed (Astro enforces it in build, so this is safety)
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_URI} !index.php
  RewriteCond %{REQUEST_URI} !/$
  RewriteRule ^(.*)$ $1/ [L,R=301]
</IfModule>
