# ──────────────────────────────────────────────────────────
# Fireworld Fiber Glass — Apache .htaccess
# ──────────────────────────────────────────────────────────

# Custom 404 error page
ErrorDocument 404 /404.html

# Redirect www to non-www (update domain when deploying)
# RewriteEngine On
# RewriteCond %{HTTP_HOST} ^www\.fireworldfiberglass\.com [NC]
# RewriteRule ^(.*)$ https://fireworldfiberglass.com/$1 [R=301,L]

# Force HTTPS (uncomment when SSL is active)
# RewriteEngine On
# RewriteCond %{HTTPS} off
# RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Enable compression (Gzip)
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/css text/javascript
    AddOutputFilterByType DEFLATE application/javascript application/json
    AddOutputFilterByType DEFLATE image/svg+xml application/xml
</IfModule>

# Browser caching
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/jpg "access plus 1 year"
    ExpiresByType image/jpeg "access plus 1 year"
    ExpiresByType image/png "access plus 1 year"
    ExpiresByType image/webp "access plus 1 year"
    ExpiresByType image/svg+xml "access plus 1 year"
    ExpiresByType image/ico "access plus 1 year"
    ExpiresByType text/css "access plus 6 months"
    ExpiresByType application/javascript "access plus 6 months"
    ExpiresByType text/html "access plus 1 day"
</IfModule>

# Security headers
<IfModule mod_headers.c>
    Header set X-Content-Type-Options "nosniff"
    Header set X-Frame-Options "SAMEORIGIN"
    Header set X-XSS-Protection "1; mode=block"
    Header set Referrer-Policy "strict-origin-when-cross-origin"
</IfModule>

# Prevent directory listing
Options -Indexes

# Remove .html extension (optional — remove # to enable)
# RewriteEngine On
# RewriteCond %{REQUEST_FILENAME} !-d
# RewriteCond %{REQUEST_FILENAME}.html -f
# RewriteRule ^(.*)$ $1.html [L]
