【问题标题】:How detect browser with .htaccess如何使用 .htaccess 检测浏览器
【发布时间】:2011-09-08 08:24:32
【问题描述】:

当用户没有从手机进入网站时,我想用 .htaccess 检测用户浏览器并重定向

【问题讨论】:

标签: php html .htaccess wap wml


【解决方案1】:

你可以从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]

根据需要进行调整。

【讨论】:

    猜你喜欢
    • 2018-06-19
    • 2017-02-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-13
    • 2011-03-10
    • 2013-10-21
    • 2013-12-04
    相关资源
    最近更新 更多