如何防止深度链接到我网站上的文件 [英] How to prevent deep linking to files on my website

查看:24
本文介绍了如何防止深度链接到我网站上的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我拥有一个网站,其中包含许多可供下载的免费软件.我面临的问题是来自世界各地的人们正在使用直接链接文件(例如 .zip 文件)并将它们张贴在他们的网站和一般论坛上.我获得了大量带宽,这没关系,但访问的页面数量很少.有没有一种方法或脚本可以添加到链接中,以便当有人按下来自外国网站的链接时,会打开我网站上的一个页面,然后让他下载文件,这样我就可以获得更多访问.

I own a website which contain a lot of freeware stuff to download on it. The problem I'm facing is that people from around the world are taking the direct links of the files (for example .zip files) and posting them on their websites and general forums. I am getting a huge amount of bandwidth and that's ok, but the number of pages visited is low. Is there a way or a script that I can add to the links, so that when someone presses on the link from a foreign website, a page from my website opens instead, which then lets him download the file so I can get more visits.

例如,这是我网站上的地址:

For example, this is a address from my website:

http://sy-stu.org/stu/PublicFiles/StdLibrary/考试.zip

当有人按下它时,它会直接开始下载过程.

When anyone presses on it, it will start the downloading process directly.

推荐答案

如果您使用的是 PHP,您可以拥有一个将用户链接到下载的脚本,但前提是 $_SERVER['HTTP_REFERER'] 来自您的网站.如果不是,则重定向到您的网站.

If you are using PHP, you can have a script that links the user to the download but only if the $_SERVER['HTTP_REFERER'] is from your site. If it is not you redirect to your site.

这篇关于如何防止深度链接到我网站上的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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