将您的 cookie 过期时间设置为 2 分钟

Set cookie expiration to 2 minutes for yourls

我是 YOURLS and just set it up on nmdrp.me to be able to forward to my site, namedrop.io. For e.g. nmdrp.me/1 的新手。

我要解决的挑战是,一旦我从同一个浏览器再次转到 nmdrp.me/1 on my Chrome browser the first time, the Counter for the page goes +1. But then when I got to nmdrp.me/1(无论多少分钟后),计数器都不会上升。

Bit.ly 能够在 2 分钟后从同一浏览器中获取对站点的下一次访问。

我认为这是因为 nmdrp.me 上有一个默认设置为不会过期的 cookie - 我想更改它。

你能告诉我如何更改 cookie.php 以能够设置 2 分钟后过期的 cookie,这样我也可以在同一浏览器上进行下一次访问吗?

与 cookie 无关 - http://nmdrp.me/1 提供 301 重定向。 301 重定向("permanent")由浏览器缓存 - 后续访问相同 URL 将从缓存而不是您的服务器提供服务,这意味着不再计算点击次数。

a few places in the codebase 如果你想调整这个,你需要改变。

编辑: Bit.ly 使用 header、Cache-Control: private, max-age=90 来解决这个问题,他们的 301 将缓存限制为 90 秒。