Skip to content

Instantly share code, notes, and snippets.

@robbestad
Last active December 19, 2015 04:19
Show Gist options
  • Save robbestad/5896659 to your computer and use it in GitHub Desktop.
Save robbestad/5896659 to your computer and use it in GitHub Desktop.
.htaccess stuff
# Apache 1.3>
# Force download certain file types.
# REPLACES
# AddType application/octet-stream .doc .mov .avi .pdf .xls .mp4
<FilesMatch "\.(docx?|txt|rtf|avi|mov|mp[34]|pdf|xls|jpe?g|tiff?)$">
Header add Content-Disposition "attachment"
</FilesMatch>
# Speed things up
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>
#
# Let html files act as php files
# Not a great idea, but doable
AddType application/x-httpd-php .php .htm .html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment