Options -MultiViews -Indexes
DirectoryIndex index.html
DirectorySlash Off

<IfModule mod_rewrite.c>
  RewriteEngine On

  # Giveaway stays up through the end of November 1, 2026 (Central),
  # which is 2026-11-02 06:00:00 UTC. After that, /giveaway sends visitors home.
  # This redirect is temporary so the page can be reused: update this timestamp
  # together with GIVEAWAY_CLOSE in giveaway-gate.js.
  RewriteCond %{TIME} >=20261102060000
  RewriteRule ^giveaway(?:/index\.html)?/?$ / [R=302,L]

  # Old /html/... addresses
  RewriteRule ^html/services/([^/]+)/?(?:index\.html)?$ /services/$1 [R=301,L]
  RewriteRule ^html/(about|giveaway)/?(?:index\.html)?$ /$1 [R=301,L]

  # /index.html -> /
  RewriteCond %{THE_REQUEST} \s/+index\.html[\s?] [NC]
  RewriteRule ^index\.html$ / [R=301,L]

  # /services/name/index.html, /about/index.html, /giveaway/index.html -> clean path
  RewriteCond %{THE_REQUEST} \s/+(services/[^/\s]+|about|giveaway)/index\.html[\s?] [NC]
  RewriteRule ^ /%1 [R=301,L]

  # Drop the trailing slash on those same pages
  RewriteCond %{THE_REQUEST} \s/+(services/[^/\s]+|about|giveaway)/[\s?] [NC]
  RewriteRule ^ /%1 [R=301,L]

  # Serve the folder's index.html while keeping the clean address
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME}/index.html -f
  RewriteRule ^(.+?)/?$ $1/index.html [L]
</IfModule>
