# Enable URL rewriting
RewriteEngine On
RewriteBase /

# Set default index file
DirectoryIndex index.html

# -----------------------------------
# 1. REMOVE TRAILING SLASH (SEO FIX)
# -----------------------------------
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [R=301,L]

# -----------------------------------
# 2. PREVENT REWRITE FOR REAL FILES/FOLDERS
# -----------------------------------
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

# -----------------------------------
# 3. CLEAN URL → .html
# -----------------------------------
RewriteRule ^service$ service.html [L]
RewriteRule ^product$ product.html [L]
RewriteRule ^contact$ contact.html [L]

# -----------------------------------
# 4. GENERIC HTML HANDLER
# -----------------------------------
RewriteRule ^([^/]+)$ $1.html [L]
