0

I am trying to get all the files in a particular folder to force download:

I created a .htaccess file but this does not work

AddHandler cgi-script .php .pl .py .jsp .asp .htm .shtml .sh .cgi 
Options -ExecCGI

Basically, I don't want any script or anything to execute. I want everything to download from that folder.

Any suggestions?

2 Answers 2

2

You can do it on an extension by extension basis with AddHandler

AddHandler default-handler php pl py jsp asp

However this is cumbersome as you need to keep on top of every possible extension. You can set the default handler for every file within a htaccess file with SetHandler. And this would be my preferred method. Simply enter this into your htaccess file.

SetHandler default-handler 

If you don't have permissions to do this in your htaccess, you'll need to get it entered in a Directory directive in your Apache configuration:

<Directory /path/to/dir>
    SetHandler default-handler
</Directory>
0

A simpler solution to download ALL the files in a folder.

.htaccess in that folder

Header set Content-Disposition attachment

But this needs Headers module to be loaded in apache

LoadModule headers_module modules/mod_headers.so 

and one more thing Browser cached images won't download.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .