Currently I have some zip files stored in the http root of my php/apache web server.
Currently I can access the files using this:
http://example.com/filename.zip
However, I want to "protect" the access to this files, and they should only be accessible using something like:
http://example.com/key/filename.zip
Could someone help me to create a rewrite rule to do this?
The key is a fixed string. It will be hardcoded in .htaccess
rules.
When the user accesses the following URL:
http://example.com/key/filename.zip
He should be able to download the zip file.
When the user accesses the following URL:
http://example.com/filename.zip
He should not be able to download the zip file. He should receive an http error.
My code so far:
RewriteEngine on
RewriteRule ^key/(\w+).zip $1.zip