Apache 配置可以检查 cookie 吗?
我的情况:
我们的网站有移动版本,并且希望开始将移动用户重定向到该网站。计划是在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
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.