我已经使用下面的.htaccess代码为移动/桌面重定向提供了一个不错的工作解决方案,但是如果有人可以提供帮助,还有一些可以真正实现最终的增强功能.
目录设置:
Cookie启用链接:
当前.htaccess文件:
RewriteEngine on
# Check if this is the desktop to mobile query string
RewriteCond %{QUERY_STRING} (^|&)m=1(&|$)
# Set a cookie, and skip the next 2 rules
RewriteRule ^ - [CO=mredir:1:%{HTTP_HOST},S=2]
# Check if this is the mobile to desktop query string
RewriteCond %{QUERY_STRING} (^|&)m=0(&|$)
# Set a cookie, and skip the next rule
RewriteRule ^ - [CO=mredir:0:%{HTTP_HOST},S]
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
# Check if we're not already …Run Code Online (Sandbox Code Playgroud)