Apache 配置可以检查 cookie 吗?

发布于 2024-08-26 20:54:08 字数 400 浏览 6 评论 0原文

我的情况:

我们的网站有移动版本,并且希望开始将移动用户重定向到该网站。计划是在 Apache httpd.conf.htaccess 中执行此操作,使用如下内容:

RewriteEngine On

RewriteCond %{HTTP_USER_AGENT} (iPhone|Blackberry|...)
RewriteRule (.*) mobile/$1

但是,我们希望用户有一种方法可以覆盖我们的默认操作重定向他们。我们想到的一种方法是在移动网站上显示一个指向常规网站的链接,并在他们使用该链接时存储 cookie。

Apache 配置文件可以在重定向之前检查 cookie 吗?

有更好的办法吗?

My situation:

We have a mobile version of our website, and want to start redirecting mobile users to it. The plan is to do this in Apache httpd.conf or .htaccess, using something like this:

RewriteEngine On

RewriteCond %{HTTP_USER_AGENT} (iPhone|Blackberry|...)
RewriteRule (.*) mobile/$1

However we want there to be a way for users to override our default action of redirecting them. One way we thought to do it was to show a link on the mobile site directing back to the regular site, and store a cookie when they use that link.

Could the Apache configuration file check a cookie before redirecting?

Is there a better way?

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

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

发布评论

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

评论(1

霞映澄塘 2024-09-02 20:54:08

HTTP_COOKIE 服务器变量包含从客户端传递到服务器的 cookie。您可以查看其中以了解脚本或模块生成了哪些 cookie。

The HTTP_COOKIE server variable contains the cookies passed from the client to the server. You can look in there to find out what cookies have been generated by a script or module.

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