简体   繁体   English

url重写/重定向iis7重定向到移动网站

[英]url rewrite/redirect on iis7 redirect to mobile site

I have made all of my mobile folder/pages structure like the desktop version. 我已将我的所有移动文件夹/页面结构制作为桌面版本。 I need to make sure all the requests from mobile devices will be re-directed to a mobile domain. 我需要确保移动设备的所有请求都会重定向到移动域。 what I would like to do is if a URL is opened from a mobile device like this: http://www.example.com/test/test.asp will be redirected to http://m.example.com/test/test.asp 我想要做的是如果从这样的移动设备打开URL: http//www.example.com/test/test.asp将被重定向到http://m.example.com/test/ TEST.ASP

this question might be asked before but I need to make sure it works. 这个问题可能会被问到,但我需要确保它有效。

Thanks very much 非常感谢

Take a look here: 看看这里:

http://forums.iis.net/t/1169853.aspx http://forums.iis.net/t/1169853.aspx

This amends your web config to redirect -- not sure if it can be used on the page level, but it might be a good start. 这会修改您的Web配置以重定向 - 不确定它是否可以在页面级别上使用,但它可能是一个好的开始。

I had the same problem and solve it. 我有同样的问题并解决它。

<rule name="Mobile Redirect" stopProcessing="true">
      <match url="(.*)" ignoreCase="true" />
      <conditions logicalGrouping="MatchAny" trackAllCaptures="false">
        <add input="{HTTP_USER_AGENT}" pattern="midp|mobil|phone" />
        <add input="{HTTP_X-Device-User-Agent}" pattern="midp|mobil|phone" />
        <add input="{HTTP_X-OperaMini-Phone-UA}" pattern="midp|mobil|phone" />
      </conditions>
      <action type="Redirect" url="http://m.yoursite.com/{R:1}" appendQueryString="true" />
    </rule>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM