Reputation: 2422
I'm using htaccess file in the root folder of my site with this content
RewriteEngine On
RewriteCond %{REQUEST_URI} \.(zip)$ [NC]
RewriteRule ^(.*)$ /getfile.php?model=$1 [L]
so no one can download any zip file unless he has access to a file called getfile.php with the model code passed as a query string even if this item is paid. So I'm checking if the session exists and if it exists the file is fetched to the main page through the getfile.php which contains this code AFTER CHECKING THE SESSION
But any one can download the file even via Internet download manager and not even visiting the website. this is an example small file of a zipped image
[http://goo.gl/bLYA6j][1]
So how can I protect a file like this even if it's free from being downloaded unless the visitor is viewing the page of this item?
Upvotes: 0
Views: 83
Reputation: 903
This should do what you want:
RewriteEngine On
RewriteRule ^(.*\.zip)$ /getfile.php?model=$1 [NC,L]
Upvotes: 1