简体   繁体   中英

Redirect website visitor to new page if from same IP

I need to redirect a website visitor to a different file on my site if they come from the same IP within the last 24 hours.

For example user 1 visits my website from IP 34.56.22.222 and he goes right to the index.php (home page).

But then he refreshes the page or comes back to the site within a 24 hour period. In that case I'd like him to be redirected to index1.php.

Is there anyway this can be done with .htaccess?

您可以在访问者网站上设置一个24小时的cookie,并检查请求是否存在cookie,然后将其重定向到index1.php(这将在客户端浏览器级别而不是ip级别上进行检查),如果要进行检查在ip级别上,则应该在redis或任何需要设置TTL 24小时的位置设置标志值,每当有新请求出现时,请检查客户端ip的标志,如果存在则重定向到index1.php,我不知道有什么办法从.htaccess做到这一点

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