# Self-hosted storefront — Apache / LiteSpeed (cPanel)
DirectoryIndex index.php index.html
Options -MultiViews
AddType text/javascript .js .mjs

<IfModule mod_rewrite.c>
    RewriteEngine On
    # Pretty PDP: /product/{slug} → product.php?slug=
    RewriteRule ^product/([A-Za-z0-9][-A-Za-z0-9_]{0,120})$ product.php?slug=$1 [L,QSA]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^ index.php [L,QSA]
</IfModule>

# Gzip / deflate text assets (Apache + LiteSpeed)
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/plain text/css text/javascript application/javascript application/json image/svg+xml
</IfModule>
<IfModule LiteSpeed>
    CacheLookup on
</IfModule>

# Long-cache immutable static (fingerprinted with ?v=)
<IfModule mod_headers.c>
    <FilesMatch "\.(?i:js|mjs|css|woff2|woff|ttf|ico|svg|png|jpg|jpeg|webp|gif)$">
        Header set Cache-Control "public, max-age=31536000, immutable"
    </FilesMatch>
</IfModule>

# Prefer brotli/gzip when available via negotiation
<IfModule mod_mime.c>
    AddType font/woff2 .woff2
    AddType font/woff .woff
</IfModule>
