1+ # Força HTTPS
2+ RewriteEngine On
3+ RewriteBase /
4+ RewriteCond %{HTTPS} off
5+ RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301 ]
6+
7+ # Redirecionar todas as URLs não encontradas para a home
8+ RewriteCond %{REQUEST_FILENAME} !-f
9+ RewriteCond %{REQUEST_FILENAME} !-d
10+ RewriteRule ^(.*)$ / [L,R=301 ]
11+
12+ # Remove extensão .html
13+ RewriteCond %{REQUEST_FILENAME} !-d
14+ RewriteCond %{REQUEST_FILENAME}.html -f
15+ RewriteRule ^(.*)$ $1.html [NC,L]
16+
17+ # Configurações de cache
18+ <IfModule mod_expires.c >
19+ ExpiresActive On
20+ ExpiresByType image/jpg "access plus 1 year"
21+ ExpiresByType image/jpeg "access plus 1 year"
22+ ExpiresByType image/gif "access plus 1 year"
23+ ExpiresByType image/png "access plus 1 year"
24+ ExpiresByType image/webp "access plus 1 year"
25+ ExpiresByType text/css "access plus 1 month"
26+ ExpiresByType application/javascript "access plus 1 month"
27+ </IfModule >
28+
29+ # Compressão GZIP
30+ <IfModule mod_deflate.c >
31+ AddOutputFilterByType DEFLATE text/plain
32+ AddOutputFilterByType DEFLATE text/html
33+ AddOutputFilterByType DEFLATE text/xml
34+ AddOutputFilterByType DEFLATE text/css
35+ AddOutputFilterByType DEFLATE application/xml
36+ AddOutputFilterByType DEFLATE application/xhtml+xml
37+ AddOutputFilterByType DEFLATE application/rss+xml
38+ AddOutputFilterByType DEFLATE application/javascript
39+ AddOutputFilterByType DEFLATE application/x-javascript
40+ </IfModule >
41+
42+ # Prevenir listagem de diretórios
43+ Options -Indexes
44+
45+ # Configurações de segurança
46+ <IfModule mod_headers.c >
47+ Header set X-Content-Type-Options "nosniff"
48+ Header set X-XSS-Protection "1 ; mode=block"
49+ Header set X-Frame-Options "SAMEORIGIN"
50+ Header set Referrer-Policy "strict-origin-when-cross-origin"
51+ </IfModule >
0 commit comments