开发者

disable direct linking to my files from the user's browser

开发者 https://www.devze.com 2023-03-13 22:14 出处:网络
I\'m using the following .htaccess configurations to disable hotlinking : RewriteEngine on RewriteCond %{HTTP_REFERER} !^$

I'm using the following .htaccess configurations to disable hotlinking :

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)mywesbite.com/开发者_运维百科.*$ [NC]
RewriteRule \.(flv|mp4|pdf|xls|doc|mov|wmv|avi)$ http://www.mywebsite.com/images/logo.jpg [R,L]

And I've tested it and everything is working fine, and now I want to disable downloading the files when the user tries to add the direct link of one of the files to his browser's address bar. Only the users that are referred to the file from my website can download it. Is there any way I can get that done by adding some more .htaccess configurations?


RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mywebsite.com(/)?.*$     [NC]
RewriteRule .*\.(flv|mp4|pdf|xls|doc|mov|wmv|avi)$ http://www.mywebsite.com/images/logo.jpg [R,NC]

Alternative if that doesnt work

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mywebsite.com(/)?.*$     [NC]
RewriteRule .*\.(flv|mp4|pdf|xls|doc|mov|wmv|avi)$ http://www.mywebsite.com/images/logo.jpg [R,NC]
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号