Forum Moderators: phranque
Our main website store videos in one especific folder of an other host/server. I need to block the direct access to this videos, mainly for people who use "bad" robots like Website Extractor, but allow people who go from the liks placed in my main website.
I used an .htaccess file in the folder of the videos with the following lines but it did not work:
order deny,allow
deny from all
allow from .my_main_web_site.com
¿What is the best way to provide access from my website but limit the access from direct visitors?
Maria
RewriteEngine on
RewriteCond %{HTTP_REFERRER} !^(www\.)?yoursite\.com
RewriteRule . - [F]
If the referrer is not yoursite.com or www.yoursite.com, the condition will be true and the request will be forbidden. If the referrer is correct, the condition will fail and the request will be processed. Your users will have to use a browser that sends referrer headers, but maybe you could indicate that on the main site?
You could add a 'bad useragent' list also:
RewriteCond %{HTTP_USER_AGENT} badbot [NC,OR]
RewriteCond %{HTTP_USER_AGENT} badbot2 [NC,OR]
RewriteCond %{HTTP_USER_AGENT} badbot3 [NC]
RewriteRule . - [F]
Hope this helps.
Justin
[edited by: jd01 at 6:34 pm (utc) on May 25, 2005]