drj26159 2012-02-23 21:25
浏览 43
已采纳

重定向移动设备的最佳方式[重复]

Possible Duplicate:
Mobile Redirect using htaccess

Currently I have a regular website, utilizing LAMP. I'd like to add a redirect for mobile devices to a subdomain, something like: m.mydomain.com

There's going to be some content differences between the content for PC and mobile devices.

What is the best way to do that? Can it be done with .htaccess file or do I need some sort of PHP script?

Thanks.

  • 写回答

3条回答 默认 最新

  • douben1891 2012-02-23 21:36
    关注

    I think .htaccess would be the fastest. you might put something like this in your htaccess file.

    RewriteCond %{HTTP_HOST} ^www\.mydomain\.com [NC]
    RewriteCond %{HTTP_USER_AGENT} "android|blackberry|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
    RewriteRule ^(.*)$ http://m.mydomain.com/$1 [L,R=302]
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 yolov8边框坐标
  • ¥15 matlab中使用gurobi时报错
  • ¥15 WPF 大屏看板表格背景图片设置
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真