# ----------------------------------------
# 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
RewriteRule ^(.*) /erro.php?pagina_erro=$1 [R=301,L]
#RewriteRule ^(.*) http://localhost/FreeTimeFitness/layout-novo/erro.php?pagina_erro=$1 [R=301,L]

# ----------------------------------------
# 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 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType video/ogg "access plus 1 month"
ExpiresByType audio/ogg "access plus 1 month"
ExpiresByType video/mp4 "access plus 1 month"
ExpiresByType video/webm "access plus 1 month"
ExpiresByType text/x-component "access plus 1 month"
ExpiresByType application/x-font-ttf "access plus 1 month"
ExpiresByType font/opentype "access plus 1 month"
ExpiresByType application/x-font-woff "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType application/x-javascript "access plus 1 month"