如何制作私有网址?

发布于 2025-01-04 06:36:58 字数 439 浏览 5 评论 0原文

我想创建一个私人网址,

http://domain.com/content.php?secret_token=XXXXX

然后,只有拥有确切网址(例如通过电子邮件收到)的访问者才能看到该页面。我们在显示内容之前检查 $_GET['secret_token']

我的问题是,如果搜索机器人有机会找到该 URL,它们将简单地对其进行索引,并且该 URL 将是公开的。有没有实用的方法来避免机器人访问和后续索引?

可能但不利的方法:

  1. 登录系统(例如通过 php 会话):但我不想提供用户登录。

  2. 受密码保护的文件夹:问题如上。

  3. 使用Robots.txt:许多搜索引擎机器人不尊重它。

I want to create a private url as

http://domain.com/content.php?secret_token=XXXXX

Then, only visitors who have the exact URL (e.g. received by email) can see the page. We check the $_GET['secret_token'] before displaying the content.

My problem is that if by any chance search bots find the URL, they will simply index it and the URL will be public. Is there a practical method to avoid bot visits and subsequent index?

Possible But Unfavorable Methods:

  1. Login system (e.g. by php session): But I do not want to offer user login.

  2. Password-protected folder: The problem is as above.

  3. Using Robots.txt: Many search engine bots do not respect it.

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

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

发布评论

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

评论(6

没有心的人 2025-01-11 06:36:58

你所说的是通过默默无闻实现安全。这从来都不是一个好主意。如果您必须这样做,我会提供以下想法:

  • 让链接过期
  • 将链接锁定到第一次访问的 C 类或 D 类 IP
  • 在转发到真实页面之前,让页面用类似逻辑问题的内容向用户提出挑战带有时间敏感令牌的页面(2步过程),如果挑战失败,则发送 404 返回,以便爬虫停止。

What you are talking about is security through obscurity. Its never a good idea. If you must, I would offer these thoughts:

  • Make the link expire
  • Lock the link to the C or D class of IPs that it was accessed from the first time
  • Have the page challenge the user with something like a logic question before forwarding to the real page with a time sensitive token (2 step process), and if the challenge fails send a 404 back so the crawler stops.
谁的新欢旧爱 2025-01-11 06:36:58

尝试生成一个 5-6 字母数字密码并附加到电子邮件中,这样即使机器人抓取它,它们也需要密码才能访问该页面。 (只是额外的安全措施)

Try generating a 5-6 alphanumeric password and attach along with the email, so eventhough robots spider it , they need password to access the page. (Just an extra added safety measure)

心头的小情儿 2025-01-11 06:36:58
  • 如果没有指向它的链接(包括该文件夹没有索引
    view),机器人找不到它
  • 如果令牌错误,您可以返回 404:这样,机器人(以及其他没有令牌的人)会认为,没有这样的页面
  • If there is no link to it (including that the folder has no index
    view), the robot won't find it
  • You could return a 404, if the token is wrong: This way, a robot (and who else doesn't have the token) will think, there is no such page
清君侧 2025-01-11 06:36:58

只要您不链接到它,蜘蛛就不会拾取它。而且,由于您不需要任何密码保护,因此该链接适用于所有人。考虑在使用密钥后将其禁用。

As long as you don't link to it, no spider will pick it up. And, since you don't want any password protection, the link is going to work for everyone. Consider disabling the secret key after it is used.

眼眸里的那抹悲凉 2025-01-11 06:36:58

您只需要告诉搜索引擎不要索引 /content.php,并且尊重 robots.txt 的搜索引擎不会索引任何以 /content 开头的页面.php

you only need to tell the search engines not to index /content.php, and search engines that honor robots.txt wont index any pages that start with /content.php.

苯莒 2025-01-11 06:36:58

大多数情况下,不发布链接是可以的……

但是,我会警告您,浏览器工具栏(想到谷歌和雅虎)的流行改变了游戏规则。我工作过的一家公司的网页来自其内部网已在 Google 中建立索引。您可以搜索该页面,然后会出现一些结果,但除非您位于我们的防火墙或 VPN 内,否则您无法访问它们。

我们认为这些链接传播到 Google 的唯一方法必须是通过工具栏。 (如果其他人有更好的解释,我很想听听......)我已经离开那家公司有一段时间了,所以我不知道他们是否已经弄清楚那里发生了什么。

我知道,奇怪但真实......

Leaving the link unpublished will be ok in most circumstances...

...However, I will warn you that the prevalence of browser toolbars (Google and Yahoo come to mind) change the game. One company I worked for had pages from their intranet indexed in Google. You could search for the page, and a few results came up, but you couldn't access them unless you were inside our firewall or VPN'd in.

We figured the only way those links got propagated to Google had to be through the toolbar. (If anyone else has a better explanation, I'd love to hear it...) I've been out of that company a while now, so I don't know if they ever figured out definitively what happened there.

I know, strange but true...

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