Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.