Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way with htaccess rules to stop the download of a specific zip file unless its been linked through the site. Ie. Stop people from copy and pasting of link or pasting link onto address bar or another site.

share|improve this question

Something similar to regular hotlink protection should work:

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?domain\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule filename\.zip$ - [F]

Essentially, specify your domain, and if the referrer doesn't match it will return a 403 - forbidden page instead of the file.

Be careful with referrers though, as they may not always be set.

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.