Created
February 22, 2018 14:18
-
-
Save anonymous/9a5c85127269251380368e008ea471ea to your computer and use it in GitHub Desktop.
Apache root file .htaccess
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine On | |
RewriteCond %{SCRIPT_FILENAME} !-f | |
RewriteCond %{SCRIPT_FILENAME} !-d | |
RewriteRule ^(.*)$ index.php?url=$1 | |
<FilesMatch "\.(ttf|ttc|otf|eot|woff)$"> | |
<IfModule mod_headers.c> | |
Header set Access-Control-Allow-Origin "*" | |
</IfModule> | |
</FilesMatch> | |
<IfModule mod_deflate.c> | |
# Insert filter | |
AddOutputFilterByType DEFLATE text/plain | |
AddOutputFilterByType DEFLATE text/xml | |
AddOutputFilterByType DEFLATE application/xhtml+xml | |
AddOutputFilterByType DEFLATE text/css | |
AddOutputFilterByType DEFLATE application/xml | |
AddOutputFilterByType DEFLATE image/svg+xml | |
AddOutputFilterByType DEFLATE application/rss+xml | |
AddOutputFilterByType DEFLATE application/atom_xml | |
AddOutputFilterByType DEFLATE application/x-javascript | |
AddOutputFilterByType DEFLATE application/javascript | |
AddOutputFilterByType DEFLATE application/x-httpd-php | |
AddOutputFilterByType DEFLATE application/x-httpd-fastphp | |
AddOutputFilterByType DEFLATE application/x-httpd-eruby | |
AddOutputFilterByType DEFLATE text/html | |
SetOutputFilter DEFLATE | |
# Netscape 4.x has some problems... | |
BrowserMatch ^Mozilla/4 gzip-only-text/html | |
# Netscape 4.06-4.08 have some more problems | |
BrowserMatch ^Mozilla/4\.0[678] no-gzip | |
# MSIE masquerades as Netscape, but it is fine | |
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html | |
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48 | |
# the above regex won't work. You can use the following | |
# workaround to get the desired effect: | |
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html | |
# Don't compress images | |
SetEnvIfNoCase Request_URI \ | |
\.(?:gif|jpe?g|png)$ no-gzip dont-vary | |
</IfModule> | |
# Compressão dos arquivos listados abaixo | |
<ifModule mod_deflate.c> | |
<filesMatch "\.(js|css|html|php)$"> | |
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript | |
</filesMatch> | |
</ifModule> | |
# Ou comprimir certos ficheiros por extenção: | |
<Files *.html> | |
SetOutputFilter DEFLATE | |
</Files> | |
# Aproveitando o cache do navegador | |
#Força a utilizar Cache-Control e Expires header | |
<IfModule mod_headers.c> | |
Header unset ETag | |
</IfModule> | |
FileETag None | |
<IfModule mod_expires.c> | |
ExpiresActive on | |
ExpiresDefault "access plus 1 month" | |
ExpiresByType text/cache-manifest "access plus 0 seconds" | |
# Html | |
ExpiresByType text/html "access plus 0 seconds" | |
# Data | |
ExpiresByType text/xml "access plus 0 seconds" | |
ExpiresByType application/xml "access plus 0 seconds" | |
ExpiresByType application/json "access plus 0 seconds" | |
# Feed | |
ExpiresByType application/rss+xml "access plus 1 hour" | |
ExpiresByType application/atom+xml "access plus 1 hour" | |
# Favicon | |
ExpiresByType image/x-icon "access plus 1 week" | |
# Media: images, video, audio | |
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" | |
# HTC files | |
ExpiresByType text/x-component "access plus 1 month" | |
# Webfonts | |
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" | |
# CSS / JS | |
ExpiresByType text/css "access plus 1 year" | |
ExpiresByType application/javascript "access plus 1 year" | |
ExpiresByType application/x-javascript "access plus 1 year" | |
</IfModule> | |
#Força o IE a sempre carregar utilizando a última versão disponível | |
<IfModule mod_headers.c> | |
Header set X-UA-Compatible "IE=Edge,chrome=1" | |
<FilesMatch "\.(js|css|gif|png|jpeg|pdf|xml|oga|ogg|m4a|ogv|mp4|m4v|webm|svg|svgz|eot|ttf|otf|woff|ico|webp|appcache|manifest|htc|crx|oex|xpi|safariextz|vcf)$" > | |
Header unset X-UA-Compatible | |
</FilesMatch> | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment