我刚刚创建了一个移动网站,并意识到我希望用户能够查看完整的桌面网站。
我知道有一种方法可以检查 .htaccess 文件中是否有 cookie,我想知道是否也有一种方法可以设置 cookie。
我的代码:
#redirect
RewriteCond %{HTTP_HOST} !^m\.stage.sunjournal\.com$
RewriteCond %{HTTP_USER_AGENT} "android|iPhone|blackberry|ipad|iemobile|operamobile|palmos|webos|googlebot-mobile" [NC]
RewriteRule ^(.*)$ http://m.stage.sunjournal.com/$1 [L,R=302]
有没有办法设置 cookie 并进行检查,以便我的用户可以从他们的移动设备访问完整的网站?
I just created a mobile site and realized that I wanted the users to be able to view the full desktop site.
I know there is a way to check if there is a cookie with the .htaccess file, I'm wondering if there's a way to set a cookie as well.
My code:
#redirect
RewriteCond %{HTTP_HOST} !^m\.stage.sunjournal\.com$
RewriteCond %{HTTP_USER_AGENT} "android|iPhone|blackberry|ipad|iemobile|operamobile|palmos|webos|googlebot-mobile" [NC]
RewriteRule ^(.*)$ http://m.stage.sunjournal.com/$1 [L,R=302]
Is there a way to set a cookie and check, so my users can access the full site from their mobile devices?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
continue
Sure you can -- use
[CO]
flag to set the cookie. For example:Obviously, you need to adjust it to whatever cookie name/value/etc you are using.
Documentation: http://httpd.apache.org/docs/current/rewrite/flags.html#flag_co