Vai al contenuto principale
kitlocal.dev

Generatore .htaccess

Esecuzione locale

Elaborazione al 100% nel tuo browser. Input e output non lasciano mai il tuo dispositivo.

Genera regole Apache .htaccess per redirect, rewrite e sicurezza.

Regole Apache

Combina reindirizzamenti, caching e routing SPA in un file .htaccess scaricabile.

Configurazione rapida

Richiede Apache 2.4 e i moduli relativi con permessi AllowOverride. Testa su un sito di staging. Dietro un proxy che termina TLS, configura prima sul server il rilevamento attendibile di HTTPS.

I reindirizzamenti canonici puntano al dominio fisso sopra. Con Forza HTTPS disabilitato, viene mantenuto lo schema HTTP o HTTPS corrente. I reindirizzamenti permanenti possono essere memorizzati nella cache dai browser.

.htaccess

# Generated by KitLocal — Apache 2.4; AllowOverride must permit these directives.

RewriteEngine On

# Canonical redirect (fixed host avoids trusting HTTP_HOST).
RewriteCond %{HTTPS} !=on [OR]
RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
RewriteRule ^ https://example.com%{REQUEST_URI} [R=301,L,NE]

<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/plain text/css application/json application/javascript image/svg+xml
</IfModule>

<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/jpeg "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType text/css "access plus 1 week"
    ExpiresByType application/javascript "access plus 1 week"
</IfModule>

<IfModule mod_headers.c>
    Header always set X-Content-Type-Options "nosniff"
    Header always set Referrer-Policy "strict-origin-when-cross-origin"
</IfModule>
26 righe893 byte.htaccess