Skip to content

Instantly share code, notes, and snippets.

@ThatGuySam
Last active July 22, 2018 13:05
Show Gist options
  • Save ThatGuySam/e45685d8e896f7c4601be92a21a85bc4 to your computer and use it in GitHub Desktop.
Save ThatGuySam/e45685d8e896f7c4601be92a21a85bc4 to your computer and use it in GitHub Desktop.
Compression and caching for MediaTemple Grid Shared Hosting
# Put in same folder as the html folder
# ex: /domains/example.com/.htaccess
# http://clicknathan.com/web-design/gzip-compression-on-mediatemple/
# BEGIN (mt) controlled settings
<IfModule !mod_fcgid.c>
AddHandler php-stable .php
</IfModule>
<IfModule mod_fcgid.c>
AddHandler fcgid-script .php
<Files *.php>
Options +ExecCGI
</Files>
</IfModule>
# END (mt) controlled settings
# BEGIN Compression
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript image/svg+xml
</ifmodule>
# END Compression
# Enable expirations
ExpiresActive On
# Set default expire time
ExpiresDefault "access 2 week"
# Specify expire time by file type
ExpiresByType image/jpg "access 1 month"
ExpiresByType image/jpeg "access 1 month"
ExpiresByType image/gif "access 1 month"
ExpiresByType image/png "access 1 month"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType image/x-icon "access 1 month"
## END EXPIRE CACHING ##
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment