# ----------------------------------------
# Desabilita listagem de diretório
# ----------------------------------------
Options +FollowSymlinks
RewriteEngine On
# ----------------------------------------
# Rediorecionamento para a página de erro
# ----------------------------------------
# Redireciona para index caso seja qualquer uma dessas extensões
# Redireciona para a página de erro caso não seja imagem e não exista o arquivo
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}\.php !-f
ErrorDocument 404 /erro-404.php
#ErrorDocument 404 /http://localhost/Sitebase-Midia/erro-404.php
# ----------------------------------------
# Rediorecionamento www
# ----------------------------------------
# RewriteCond %{HTTP_HOST} !^www.
# RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301]
# ----------------------------------------
# remover /index.php da URL
# ----------------------------------------
# RewriteRule ^index.php$ / [r=301,NC,L]
# ----------------------------------------
# URL Amigável
# ----------------------------------------
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
# ----------------------------------------
# Compactar arquivos automaticamente
# ----------------------------------------
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript image/jpeg image/png image/gif
# ----------------------------------------
# #Cria cache para melhorar o PageSpeed
# ----------------------------------------
Header unset ETag
FileETag None
ExpiresActive on
ExpiresDefault "access plus 1 month"
ExpiresByType text/cache-manifest "access plus 1 hour"
ExpiresByType text/html "access plus 1 hour"
ExpiresByType text/xml "access plus 1 hour"
ExpiresByType application/xml "access plus 1 hour"
ExpiresByType application/json "access plus 1 hour"
ExpiresByType application/rss+xml "access plus 1 month"
ExpiresByType application/atom+xml "access plus 1 month"
ExpiresByType image/x-icon "access plus 4 month"
ExpiresByType image/gif "access plus 4 month"
ExpiresByType image/png "access plus 4 month"
ExpiresByType image/jpg "access plus 4 month"
ExpiresByType image/jpeg "access plus 4 month"
ExpiresByType image/webp "access plus 4 month"
ExpiresByType image/svg+xml "access plus 4 month"
ExpiresByType audio/ogg "access plus 1 month"
ExpiresByType video/ogg "access plus 4 month"
ExpiresByType video/mp4 "access plus 4 month"
ExpiresByType video/webm "access plus 4 month"
AddType application/x-font-ttf .ttf
AddType application/x-font-woff .woff
AddType application/x-font-woff2 .woff2
ExpiresByType text/x-component "access plus 1 year"
ExpiresByType font/opentype "access plus 1 year"
ExpiresByType application/x-font-ttf "access plus 1 year"
ExpiresByType application/x-font-woff "access plus 1 year"
ExpiresByType application/x-font-woff2 "access plus 1 year"
ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType application/x-javascript "access plus 1 month"