Allow download filetype previously denied in .htaccess?

Discussion in 'PHP' started by PoPSiCLe, Mar 27, 2009.

  1. #1
    Hi.

    I generate a CSV-file from a mysql_query. That works fine, and I can see the file being created and such. It works.

    In my .htaccess I have a deny from all rule for certain filetypes:
    
    <FilesMatch "\.(inc|txt|html|csv)$">
    order allow,deny
    deny from all
    </FilesMatch>
    
    Code (markup):
    Unfortunately, this also mean I can't just put a link to the CSV-file from the page it's being generated on - I get an "access denied" if I try to open it or download it.

    So... how do I fix this? I would still like for anyone not logged in as admin to not be able to download the file, or see it, for that matter, but how do I allow myself to download it?
     
    PoPSiCLe, Mar 27, 2009 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    Nevermind - I found the answer :)

    Just made another .php-file which opens, reads and downloads the csv-file
     
    PoPSiCLe, Mar 28, 2009 IP