# Easypeasy Feaso — Apache/.htaccess config for Hostinger shared hosting
# This file enables:
# - SPA routing fallback (any unknown URL → 404.html, which Next.js handles)
# - HTTPS redirect
# - Gzip compression
# - Long-lived caching for static assets
# - Security headers
# ----- 1. SPA routing fallback (Next.js static export) -----
RewriteEngine On
# Force HTTPS
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# If the requested file/directory doesn't exist, serve 404.html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ /404.html [L]
# ----- 2. Long-lived caching for static assets (hashed filenames) -----
ExpiresActive On
ExpiresByType text/css "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType image/png image/jpeg image/svg+xml image/webp image/avif "access plus 1 year"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresByType font/woff2 font/woff font/ttf "access plus 1 year"
ExpiresByType text/html "access plus 1 hour"
ExpiresDefault "access plus 1 day"
# ----- 3. Gzip compression -----
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/javascript application/json application/xml image/svg+xml
# ----- 4. Security headers -----
Header set X-Content-Type-Options "nosniff"
Header set X-Frame-Options "SAMEORIGIN"
Header set Referrer-Policy "strict-origin-when-cross-origin"
Header set Permissions-Policy "geolocation=(), microphone=(), camera=()"
# Allow service worker for PWA
Header set Service-Worker-Allowed "/"
# ----- 5. Service worker MIME type (for PWA) -----
AddType application/javascript .js
AddType application/manifest+json .webmanifest
AddType application/wasm .wasm
# ----- 6. Disable directory listing -----
Options -Indexes
# ----- 7. Protect sensitive files -----
Require all denied