文章 2021-12-28 来自:开发者社区

Nginx根据Pc端和手机端访问不同页面

有的时候一个网站需要区别是pc访问的 还是手机访问的,根据平台的不同让他跳转到不同的入口;可以这样实现: server { ### nginx 用来当静态资源的服务器 listen 83; server_name localhost; underscores_in_headers on; # 是手机还是pc set $mobile_rewrite ispc...

文章 2019-06-08 来自:开发者社区

Nginx如何处理手机端和PC端跳转不同页面

如果是手机端和pc端需要跳转不同的页面, 则需要在nginx.conf中的location / {}中加入如下代码: if ($http_user_agent ~* '(Android|webOS|iPhone|iPod|BlackBerry)') { rewrite ^.+ http://127.0.0.1:8080/mobile/$uri; } 其中mobile为手机端的路径标识, ...

本页面内关键词为智能算法引擎基于机器学习所生成,如有任何问题,可在页面下方点击"联系我们"与我们沟通。

产品推荐

{"cardStyle":"productCardStyle","productCode":"aliyun","productCardInfo":{"productTitle":"部署Nginx并通过Ingress暴露和监控服务","productDescription":"在阿里云容器服务(后简称ACK)集群中通过YAML文件快速部署一个Nginx应用并通过Nginx Ingress暴露和监控服务,结合使用ACK、日志服务、专有网络搭建业务部署运维方案。","productContentLink":"https://www.aliyun.com/solution/tech-solution/nginx_ingress","isDisplayProductIcon":true,"productButton1":{"productButtonText":"方案详情","productButtonLink":"https://www.aliyun.com/solution/tech-solution/nginx_ingress"},"productButton2":{"productButtonText":"一键部署","productButtonLink":"https://help.aliyun.com/document_detail/2400022.html"},"productButton3":{"productButtonText":"查看更多技术解决方案","productButtonLink":"https://www.aliyun.com/solution/tech-solution/"},"productPromotionInfoBlock":[{"$id":"0","productPromotionGroupingTitle":"解决方案推荐","productPromotionInfoFirstText":"MSE实现全链路灰度","productPromotionInfoFirstLink":"https://www.aliyun.com/solution/tech-solution/iflgbomse","productPromotionInfoSecondText":"云架构必修课:云上高可用架构","productPromotionInfoSecondLink":"https://www.aliyun.com/solution/tech-solution/hablog"}],"isOfficialLogo":false},"activityCardInfo":{"activityTitle":"","activityDescription":"","cardContentBackgroundMode":"LightMode","activityContentBackgroundImageLink":"","activityCardBottomInfoSelect":"activityPromotionInfoBlock"}}