.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

Você também pode gostar de ler

Exemplo de artigo com multi títulos, mas usando só o principal

Em 01/04/2025 às 14h41 - Atualizado em 22/04/2025 às 15h41

Guia da Extensão #13 - Avaliação e Comentários

Em 01/04/2025 às 14h35 - Atualizado em 01/04/2025 às 14h41

Teste de matéria ao vivo

Em 05/11/2024 às 16h12 - Atualizado em 07/02/2025 às 11h01

Extensão #14 WebStories ou histórias web

Em 23/07/2024 às 09h28 - Atualizado em 11/11/2024 às 10h34

Guia da Extensão #13 - Avaliação e Comentários

Em 26/05/2024 às 21h39 - Atualizado em 23/09/2024 às 09h36

Call to Action - Website Inicial - App ou Botão

Em 22/07/2022 às 10h21 - Atualizado em 07/10/2022 às 11h02

Modelo Página de Contato - Websites Iniciaiss

Em 22/07/2022 às 09h09 - Atualizado em 07/10/2022 às 10h29

003. Header Clássico + Topbar + Search - Comp. Interago

Em 09/06/2022 às 17h55 - Atualizado em 16/08/2022 às 09h09