- nginx判断是否手机访问
if ( $http_user_agent ~* "(Android|iPhone|Windows Phone|UC|Kindle|MicroMessenger |iPad)" )
{
rewrite ^/(.*)$ https://要跳转的域名$uri redirect;
}
- 如果只想匹配手机 不想匹配平板
if ( $http_user_agent ~* "(Android.*Mobile|iPhone|Windows Phone|UC|Kindle|MicroMessenger)" )
- 如果只想匹配pc和mac
if ( $http_user_agent ~* "(Windows NT | Macintosh |Intel Mac OS.*)" )