开发者

Can Apache configuration check cookies?

开发者 https://www.devze.com 2022-12-24 19:15 出处:网络
My situation: We have a mobile version of our website, and want to start redirecting mobile users to it. The plan is to do th开发者_StackOverflow中文版is in Apache httpd.conf or .htaccess, using some

My situation:

We have a mobile version of our website, and want to start redirecting mobile users to it. The plan is to do th开发者_StackOverflow中文版is 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消