如果用户来自特定站点且仅该站点,我如何才能使页面仅可访问 [英] How can I make a page only accessible if the user comes from a specific site and only that site

查看:72
本文介绍了如果用户来自特定站点且仅该站点,我如何才能使页面仅可访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Web 开发的绝对新手.我只知道一点 Wordpress 没有编码知识.无论如何,为了简化我的问题,我将举一个例子,假设有一个销售汽车的网站,它有以下页面

Hi so I am an absolute novice in web development. I just know a little bit of Wordpress with no coding knowledge. Anyways to simplify my question I will give an example, say there is a website that sells cars and it has the following pages

www.site1.com/honda

www.site1.com/honda

www.site1.com/toyota

www.site1.com/toyota

www.site1.com/bmw

www.site1.com/bmw

所以我可以访问这些页面,我想在这些页面上放置一个链接到我的网站 (www.site2.com/cars) 的按钮.因此,如果这 3 个页面中的任何人单击该按钮,他们就会访问 www.site2.com/cars.现在棘手的部分是我不希望任何其他人可以访问此页面.因此,如果有人要输入 site2.com/cars,则不应加载或重定向到另一个页面或其他内容.我希望这是安全的,因为我不希望有人通过这种方式欺骗 www.site2.com/cars,但目前如果这太复杂而无法实现,我可以接受.

So I have access to these pages and I would like to place a button on these pages that links to my site (www.site2.com/cars). So if anyone from those 3 pages clicks on the button they will come to www.site2.com/cars. Now the tricky part is I don't want this page to be accessible to any other people. So if someone were to type in site2.com/cars it should not load or redirect to another page or something. I would like this to be secure like I don't want someone to spoof there way into www.site2.com/cars but at the moment if that is too complicated to achieve I am ok with it.

我在这个网站上研究过这个问题,我发现了一些类似的问题,甚至是相同的问题,但我不明白.请让我知道这是否可行,以及如何实现这一点,非常感谢.

I have looked into this on this websites and I have found some similar questions or even identical ones but I did not understand them. Please let me know if this is possible and how I can achieve this thanks very much in advance.

推荐答案

如果链接到您网站的网站不是您的并且您无法修改它,您唯一能做的就是检查传入请求的标头.有一个引用键,其中包含用户来自的网站的 URL.

If the website that links to your website is not yours and you cannot modify it, the only thing that you can do is check in the headers of the incoming request. There is a referer key that has the URL of the website the user has come from.

这篇关于如果用户来自特定站点且仅该站点,我如何才能使页面仅可访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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