<system.webServer>
<rewrite>
<rules>
位置不能弄错了
<!--302暂时跳转当手机访问pc页时跳到m版 会跳文件夹-->
<rule name="yidongzy2" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTP_HOST}" pattern="^www.xxxxxxxx.com$"/>
<add input="{HTTP_USER_AGENT}" pattern="android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos|UCBrowser|MQQBrowser|Windows Phone|wap" />
<add input="{PATH_INFO}" pattern="\.html|/$"/>
</conditions>
<action type="Redirect" url="https://m.xxxxxxxx.com/{R:0}" redirectType="Found" />
</rule>
<!--302暂时跳转当手机访问pc页时跳到m版-->
</rules>
</rewrite>
如果是文件夹结尾的url也会跳,做好之后要测试,
本文介绍如何配置IIS服务器,使手机用户访问PC网页时自动跳转至移动版网站。通过设置URL重写规则,检测用户代理字符串,实现对不同设备的智能跳转。
2万+

被折叠的 条评论
为什么被折叠?



