# Evoke Salon & Spa - SEO URL configuration
RewriteEngine On

# Force HTTPS and non-WWW
RewriteCond %{HTTPS} !=on [OR]
RewriteCond %{HTTP_HOST} ^www\.evokesalonspa\.com$ [NC]
RewriteRule ^ https://evokesalonspa.com%{REQUEST_URI} [R=301,L]

# Redirect index files to homepage
RewriteRule ^index\.(html|php)$ https://evokesalonspa.com/ [R=301,L,NC]

# Redirect .html requests to clean URLs with trailing slash
RewriteCond %{THE_REQUEST} \s/+(.+?)\.html(?:[\s?]) [NC]
RewriteRule ^(.+)\.html$ https://evokesalonspa.com/$1/ [R=301,L,NE]

# Enforce trailing slash on extensionless paths (homepage excluded)
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !\.[^/]+$
RewriteRule ^(.+)$ https://evokesalonspa.com/$1/ [R=301,L]

# Internally serve matching .html files for clean URLs
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/$1.html -f
RewriteRule ^(.+)/$ $1.html [L]
