Created
April 9, 2017 12:07
-
-
Save impshum/88f3ba4ccc8e3ef397f0ce19516faf00 to your computer and use it in GitHub Desktop.
Force https, enable compression and caching in .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 %{HTTP_HOST} ^www\.(.*) | |
RewriteRule ^.*$ https://%1/$1 [R=301,L] | |
RewriteCond %{HTTPS} off | |
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L] | |
#Gzip | |
<ifmodule mod_deflate.c> | |
<ifmodule mod_mime.c> | |
Addtype font/opentype .otf | |
Addtype font/eot .eot | |
Addtype font/truetype .ttf | |
</ifmodule> | |
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript application/javascript text/text font/opentype font/truetype font/eot | |
</ifmodule> | |
#End Gzip | |
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$"> | |
Header set Cache-Control "max-age=604800, public" | |
</FilesMatch> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment