# Clean URLs for Zenora Store
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

# Force HTTPS
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Product pages with slugs: /product/slug-name → product.html
RewriteRule ^product/([a-zA-Z0-9-]+)$ product.html?slug=$1 [L,QSA]

# Catalog page: /all-products → catalog.html
RewriteRule ^all-products$ catalog.html [L]

# Other pages without .html extension (about, contact, privacy, etc.)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.+)$ $1.html [L,QSA]
</IfModule>

# No cache for HTML and JS (so updates show immediately)
<IfModule mod_headers.c>
<FilesMatch "\.(html|htm)$">
Header set Cache-Control "no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires 0
</FilesMatch>
<FilesMatch "\.(js|css)$">
Header set Cache-Control "no-cache, must-revalidate"
</FilesMatch>
</IfModule>

# Cache images only
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpeg "access plus 1 week"
ExpiresByType image/png "access plus 1 week"
ExpiresByType image/gif "access plus 1 week"
ExpiresByType image/webp "access plus 1 week"
</IfModule>

# Gzip compression
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/css application/javascript
</IfModule>
