RewriteEngine On

# Preserve the original event-capacity URL after migration away from a
# server-side process that repeatedly truncates that exact FTP object.
RewriteRule ^date-time/event-time-slot-capacity-calculator\.html$ https://calczero.com/date-time/event-session-capacity-calculator.html [R=301,L,NE]

# HTTPS
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

# non-www (delete this block if you want to KEEP www)
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L]

# /index.html -> /
RewriteRule ^index\.html$ / [R=301,L]

# /page -> /page.html (when page.html exists)
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.+?)/?$ $1.html [R=301,L]
