下载文件夹的 Apache 热链接保护

发布于 2024-08-11 11:58:21 字数 105 浏览 2 评论 0原文

我试图避免从其他网站直接链接到我网站的可下载内容。

我的 exe、zip 和 msi 文件位于 /files 目录下。我怎样才能避免直接链接到它们?

提前致谢...

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

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

Thanks in advance...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

々眼睛长脚气 2024-08-18 11:58:21

将以下内容添加到 /files 目录中的 .htaccess 文件中

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 更改为您希望显示的图像,告诉用户不允许热链接。

有关更多详细信息,请查看:

http://altlab.com/htaccess_tutorial.html

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]

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_tutorial.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文