3

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

4

1 回答 1

8

您可以从这里开始举例。

# 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]

根据需要进行调整。

于 2011-06-04T11:23:39.323 回答