'htaccess fails to allow domain access to sub-directory
I have a sub-directory on a site with a zip file in it. I want to limit access to the zip file to certain domains. I have tried many methods but none are working. Below shows what I've tried where example.com is the calling site. I only tried one of these methods at a time but they all return a 403 result. I see many posts here about problems like this and the results are always that they work so I must be missing something. Does anyone have any suggestions?
Method 1
SetEnvIf Referer "^example\.com/" goodsites
order Deny,Allow
Deny from all
Allow from env=goodsites
Method 2
order deny,allow
deny from all
allow from example.com
Method 3
RewriteEngine on
RewriteCond %{HTTP_HOST} !^(www\.)*example\.com [NC]
RewriteRule ^(.*)$ - [F]
I added the following and it seems to do what I want.
<FilesMatch "\.(zip|exe)$">
Order Deny,Allow
Deny from all
</FilesMatch>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
