Detect iPhone browser in .htaccess/apache and redirect to iPhone site

后端 未结 4 1411
伪装坚强ぢ
伪装坚强ぢ 2021-02-03 15:29

Is it possible to detect iPhone browser agent in .htaccess and redirect the user to the correct iPhone page?

4条回答
  •  礼貌的吻别
    2021-02-03 16:06

    To add to @Tommy's response, if you want to pass through the URI, change the RewriteRules to the following:

    RewriteRule ^(.*)$ http://mobile.yourdomain.com$1 [R=301]
    

    Otherwise you'll be redirecting all requests to the mobile home page (though that might be what you want).

提交回复
热议问题