.htaccess com principais funcionalidades
Redirecionamento para sempre HTTPS, sempre www., esconder .html, nunca pastas e cache
<IfModule mod_rewrite.c>RewriteEngine On #use only https for all requests RewriteCond %{HTTPS} !=on RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] #always use www only #RewriteCond %{HTTP_HOST} !^www\. [NC] #RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
#always look for files instead os folders RewriteCond %{REQUEST_FILENAME} /$ RewriteRule ^(.*)/$ $1
# Hide extension RewriteRule ^([^\.]+)$ $1.html [NC,L] #redirect 404 errors to... ErrorDocument 404 https://componentes.interago.com.br/noticias/index </IfModule>
## EXPIRES CACHING ##<IfModule mod_expires.c> ExpiresActive On ExpiresByType image/jpg "access 1 year" ExpiresByType image/jpeg "access 1 year" ExpiresByType image/webp "access 1 year" ExpiresByType image/gif "access 1 year" ExpiresByType image/png "access 1 year" ExpiresByType text/css "access 1 month" ExpiresByType text/html "access 1 month" ExpiresByType application/pdf "access 1 month" ExpiresByType text/x-javascript "access 1 month" ExpiresByType application/x-shockwave-flash "access 1 month" ExpiresByType image/x-icon "access 1 year" ExpiresDefault "access 1 month"</IfModule>## EXPIRES CACHING ## #Gzip<ifmodule mod_deflate.c> AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript</ifmodule>#End Gzip# BEGIN Caching<ifModule mod_headers.c> <filesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf|webp|svg)$"> Header set Cache-Control "max-age=2592000, public"</filesMatch><filesMatch "\.(css)$"> Header set Cache-Control "max-age=604800, public"</filesMatch><filesMatch "\.(js)$"> Header set Cache-Control "max-age=216000, private"</filesMatch><filesMatch "\.(xml|txt)$"> Header set Cache-Control "max-age=216000, public, must-revalidate"</filesMatch><filesMatch "\.(html|htm|php)$"> Header set Cache-Control "max-age=1, private, must-revalidate"</filesMatch></ifModule># END Caching