Reputation: 3
I have a download site where I blocked access to .zip files in order to force users to go through my download process (simply means u have to register before you download).
Now I am also making a java arcade and I want the applet to be able to download zip files from a specific directory on it and play them.
Right now I am using something like in my site's root .htaccess:
RewriteRule .*\.(zip)$ http://www.google.com [R,NC]
The question is how do I tell it not to include the folder "arcade" in it. What do I modify in the above code or what do I put in the arcade/.htaccess file to make it possible to link to zips..
Thanks! - Ben
Upvotes: 0
Views: 1199
Reputation: 51
You should use the RewriteCond directive. You need something like:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/arcade/
RewriteRule \.zip$ - [F]
I have also changed the way you block access to .zip files. It's better to return a 403 error code.
Upvotes: 1
Reputation: 9539
Try
#exclude the arcade folder
RewriteCond %{REQUEST_URI} !^/arcade [NC]
RewriteRule .*\.(zip)$ http://www.google.com [R,NC]
Instead of the redirect you could also give a 404 as below. Also simplified the match for the RewriteRule
RewriteCond %{REQUEST_URI} !^/arcade [NC]
RewriteRule \.zip$ - [R=404,NC]
Upvotes: 1