Apache的防盗链的下载文件夹 [英] Apache Hotlink Protection for Download Folder

查看:231
本文介绍了Apache的防盗链的下载文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图避免从其他网站到我的网站可下载直接联系。

I'm trying to avoid direct links from other sites to my site's downloadables.

我的EXE,ZIP和MSI文件是在/文件目录。我如何才能避免直接链接到他们?

My exe,zip and msi files are under /files directory. How can I avoid direct links to them?

在此先感谢...

推荐答案

添加以下到.htaccess文件在你的/ files目录

Add the following to a .htaccess file in your /files directory

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?mysite\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*\.(exe|zip|msi)$ /images/nohotlink.jpg [L]

更改mysite.com到你的域和/images/nohotlink.jpg到图像要显示告知用户盗链,是不允许的。

Change "mysite.com" to your domain and /images/nohotlink.jpg to an image you wish to display telling users hotlinking is not allowed.

有关更详细的信息请查看:

For more detailed information check out:

http://altlab.com/htaccess%5Ftutorial.html

这篇关于Apache的防盗链的下载文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆