编程语言
首页 > 编程语言> > php – 如何使用.htaccess检测浏览器

php – 如何使用.htaccess检测浏览器

作者:互联网

我希望检测用户浏览器.htaccess&用户未从手机进入网站时重定向

解决方法:

您可以通过示例启动here.

# Rewrite requests from all user-agents except modern Internet Explorer, Firefox, Opera
RewriteCond %{HTTP_USER_AGENT} !^Mozilla/4\.[0-9]+\ \(compatible;\ MSIE\ [0-9.]+
RewriteCond %{HTTP_USER_AGENT} !^Mozilla/5\.0 \(([^;]+;\ )*[^;]+\)\ Gecko/2[0-9]{3}\ Firefox/[0-9.]+
RewriteCond %{HTTP_USER_AGENT} !^Opera/[0-9.]+
RewriteRule .* X.html [L]

根据需要调整.

标签:htaccess,html,wap,php,wml
来源: https://codeday.me/bug/20190726/1542807.html