Skip to content

Instantly share code, notes, and snippets.

@ch-gilbert
Last active December 21, 2015 05:58
Show Gist options
  • Select an option

  • Save ch-gilbert/6260620 to your computer and use it in GitHub Desktop.

Select an option

Save ch-gilbert/6260620 to your computer and use it in GitHub Desktop.
Download image file with query string download, e.g logo.jpg?download
<FilesMatch "\.(gif|jpe?g|png)$">
RewriteEngine On
RewriteCond %{QUERY_STRING} ^download$
RewriteRule ^.*$ - [E=DOWNLOAD:1]
Header set Content-Type application/octet-stream env=DOWNLOAD
Header set Content-Disposition attachment env=DOWNLOAD
</FilesMatch>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment