Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am developing a mirror website (where people can download files, sort of like a FTP). I was wondering about using CloudFlare to help cut down on bandwidth usage. I have the mirror website with mod_rewrite, so that when a user goes to http://www.example.com/xyz/file.zip it is redirected to http://www.example.com/download.php?path=xyz&file=file.zip which increments the number of downloads and outputs "file.zip". Here is the rewrite rule:

RewriteRule ^(.*)/((.*)(.zip))$ /download.php?path=$1&file=$2

I was wondering if I use CloudFlare on this website, will it pretty much render the .htaccess file useless and PHP code useless?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Based on this page, Cloudflare don't cache zip files. If the zip files are most of your bandwidth, CloudFlare won't save you much.

The RewriteRule you supplied above does not do a redirect. For a redirect, you would need something like [R] or [R=301] after the rule.

If you find a competing service that does cache zip files for you, the redirect might be the right way to achieve both your goals. Send the downloader a link to http://www.example.com/xyz/file.zip as you are currently doing (leave in the rewrite that has a PHP file serve this page) but have the PHP send back a redirect (HTTP 302 or 303 response code) sending them to http://www.example.com/realpath/file.zip. Their client will then make a new request for that URL and will actually get the file.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.