Force download of fasta files and aln files with Apache

By kenglish

If you are serving fasta files or alignment files on your server, you may want to force users to download them instead of previewing them in the browser. My application would return the fasta files as Content-Type text/plain. I wanted to force it to application/x-fasta and force download. This is accomplished rather easily in Apache with the following directive:

  <FilesMatch "\.(?i:fasta)$">
    ForceType application/x-fasta
    Header set Content-Disposition attachment
  </FilesMatch>
  <FilesMatch "\.(?i:aln)$">
    ForceType application/x-aln
    Header set Content-Disposition attachment
  </FilesMatch>

You will have to enable the apache module “mod_header” for this to work.



About... kenglish

This author published 69 posts in this site.

Share

FacebookTwitterEmailWindows LiveTechnoratiDeliciousDiggStumbleponMyspaceLikedin

Leave a comment