File: /home/storage/5/78/dd/wicomm2/public_html/semparar/.htaccess
# ============================================
# WordPress Performance Optimization
# Adicione ANTES das regras do WordPress
# ============================================
# ============================================
# 1. COMPRESSÃO GZIP
# ============================================
<IfModule mod_deflate.c>
# Comprime HTML, CSS, JavaScript, Text, XML
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/atom+xml
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/woff
AddOutputFilterByType DEFLATE font/woff2
</IfModule>
# ============================================
# 2. CACHE DO NAVEGADOR (Browser Caching)
# ============================================
<IfModule mod_expires.c>
ExpiresActive On
# Imagens - 1 ano
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "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/x-icon "access plus 1 year"
# Fontes - 1 ano
ExpiresByType font/ttf "access plus 1 year"
ExpiresByType font/otf "access plus 1 year"
ExpiresByType font/woff "access plus 1 year"
ExpiresByType font/woff2 "access plus 1 year"
ExpiresByType application/font-woff "access plus 1 year"
# CSS e JavaScript - 1 mês
ExpiresByType text/css "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType application/x-javascript "access plus 1 month"
# HTML - Sem cache (sempre atualizado)
ExpiresByType text/html "access plus 0 seconds"
</IfModule>
# Cache-Control Headers
<IfModule mod_headers.c>
# Cache para imagens
<FilesMatch "\.(jpg|jpeg|png|gif|webp|svg|ico)$">
Header set Cache-Control "public, max-age=31536000, immutable"
</FilesMatch>
# Cache para fontes
<FilesMatch "\.(ttf|otf|woff|woff2|eot)$">
Header set Cache-Control "public, max-age=31536000, immutable"
</FilesMatch>
# Cache para CSS e JS
<FilesMatch "\.(css|js)$">
Header set Cache-Control "public, max-age=2592000"
</FilesMatch>
# HTML sem cache
<FilesMatch "\.(html|htm|php)$">
Header set Cache-Control "no-cache, must-revalidate"
</FilesMatch>
</IfModule>
# ============================================
# 3. OTIMIZAÇÃO DE ETAGS
# ============================================
<IfModule mod_headers.c>
Header unset ETag
</IfModule>
FileETag None
# ============================================
# 4. SUPORTE A WEBP
# ============================================
<IfModule mod_rewrite.c>
RewriteEngine On
# Serve WebP se disponível e suportado pelo navegador
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{REQUEST_FILENAME} (.*)\.(jpe?g|png)$
RewriteCond %1.webp -f
RewriteRule ^(.+)\.(jpe?g|png)$ $1.webp [T=image/webp,E=accept:1,L]
</IfModule>
<IfModule mod_headers.c>
Header append Vary Accept env=REDIRECT_accept
</IfModule>
AddType image/webp .webp
# ============================================
# 5. HEADERS DE SEGURANÇA
# ============================================
<IfModule mod_headers.c>
# Proteção XSS
Header set X-XSS-Protection "1; mode=block"
# Previne Clickjacking
Header always set X-Frame-Options "SAMEORIGIN"
# Previne MIME sniffing
Header set X-Content-Type-Options "nosniff"
# Referrer Policy
Header set Referrer-Policy "strict-origin-when-cross-origin"
</IfModule>
# ============================================
# WORDPRESS - Regras Padrão (NÃO MODIFICAR)
# ============================================
# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress