# TAIIH public website clean URLs
# Upload this hidden file to the actual taiih.org document root.
Options -MultiViews -Indexes
DirectorySlash Off
RewriteEngine On
RewriteBase /

# /team is also a physical directory containing profile pages. Resolve the
# landing page before Apache can treat it as a directory listing.
RewriteRule ^team/?$ team/index.html [END]

# Permanently redirect legacy .html URLs to the canonical clean URL.
RewriteCond %{THE_REQUEST} \s/+(.+?)\.html(?:[\s?]|$) [NC]
RewriteRule ^(.+?)\.html$ /$1 [R=301,L,NE]

# Serve existing .html files when visitors request extensionless paths.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.+?)/?$ $1.html [END]

DirectoryIndex index.html
