# Next.js static export – cPanel public_html
# Upload contents of the "out" folder to public_html.

DirectoryIndex index.html
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /

  # Force HTTPS (uncomment when SSL is active)
  # RewriteCond %{HTTPS} off
  # RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

  # Serve index.html for directory-style URLs (trailing slash)
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME}/index.html -f
  RewriteRule ^(.*)$ $1/index.html [L]
</IfModule>

# Optional: custom 404 (if 404.html exists in out)
# ErrorDocument 404 /404.html

# If the site lives in a subfolder (e.g. public_html/mysite), set RewriteBase to that path:
# RewriteBase /mysite/
