简体   繁体   中英

Set cookie expiration to 2 minutes for yourls

I am new to YOURLS and just set it up on nmdrp.me to be able to forward to my site, namedrop.io . For eg nmdrp.me/1 .

The challenge I am trying to solve is that once I go to 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 again after that from the same browser (no matter how many minutes later), the counter doesn't go up.

Bit.ly is able to pick up the next visit to the site from the same browser after 2 minutes.

I believe this is because there is a cookie set to not expire by default on nmdrp.me - and I want to change that.

Can you please tell me how to change the cookie.php to be able to set cookies that expire in 2 minutes, so I can also pick up the next visit on the same browser?

Nothing to do with cookies - http://nmdrp.me/1 serves a 301 redirect. 301 redirects (being "permanent") are cached by the browser - subsequent visits to the same URL will be served from the cache rather than your server, meaning no more cicks counted.

There are a few places in the codebase you'll need to change if you want this adjusted.

edit: Bit.ly uses a header, Cache-Control: private, max-age=90 , to address this with their 301s to limit the cache to 90 seconds.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM