Skip to content

Instantly share code, notes, and snippets.

@jibbagist
Created December 6, 2013 09:09
Show Gist options
  • Save jibbagist/7820789 to your computer and use it in GitHub Desktop.
Save jibbagist/7820789 to your computer and use it in GitHub Desktop.
Basic htaccess file
#Makes php work in HTML
AddType application/x-httpd-php .html .htm
## EXPIRES CACHING ##
#<IfModule mod_expires.c>
#ExpiresActive On
#ExpiresByType image/jpg "access plus 1 year"
#ExpiresByType image/jpeg "access plus 1 year"
#ExpiresByType image/gif "access plus 1 year"
#ExpiresByType image/png "access plus 1 year"
#ExpiresByType text/css "access plus 1 month"
#ExpiresByType application/pdf "access plus 1 month"
#ExpiresByType text/x-javascript "access plus 1 month"
#ExpiresByType application/x-shockwave-flash "access plus 1 month"
#ExpiresByType image/x-icon "access plus 1 year"
#ExpiresDefault "access plus 2 days"
#</IfModule>
<FilesMatch "(?i)^.*\.(ico|flv|jpg|jpeg|png|gif|js|css)$">
ExpiresActive On
ExpiresDefault A2592000
</FilesMatch>
## EXPIRES CACHING ##
#Enable Gzip
# compress text, HTML, JavaScript, CSS, and XML
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
# remove browser bugs
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
<ifModule mod_headers.c>
Header set Connection keep-alive
</ifModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment