在windows2008下配置II7 web.config
当通过手机访问www域名时,自动跳转到对应的移动域名下
- <?xml version="1.0" encoding="UTF-8"?>
- <configuration>
- <system.webServer>
- <!-- http://www.whsir.com 替换为对应的网站,带www-->
- <httpRedirect enabled="false" destination="http://www.whsir.com" exactDestination="false" childOnly="false" httpResponseStatus="Permanent" />
- <!--启用Gzip压缩-->
- <urlCompression doStaticCompression="true" doDynamicCompression="false" />
- <defaultDocument>
- <files>
- <clear />
- <add value="Default.htm" />
- <add value="Default.asp" />
- <add value="index.htm" />
- <add value="index.html" />
- <add value="index.php" />
- <add value="default.aspx" />
- </files>
- </defaultDocument>
- </system.webServer>
- <system.webServer>
- <rewrite>
- <rules>
- <rule name="WWW Redirect" stopProcessing="true">
- <match url=".*" />
- <conditions>
- <!--xxx.com,替换为对应的网站,不带www-->
- <add input="{HTTP_HOST}" pattern="^whsir.com$" />
- </conditions>
- <!-- http://www.whsir.com 替换为对应的网站,带www-->
- <action type="Redirect" url="http://www.whsir.com/{R:0}" redirectType="Permanent" />
- </rule>
- <rule name="Mobile Jump" stopProcessing="true">
- <match url="^(.*)$" />
- <conditions logicalGrouping="MatchAll">
- <add input="{HTTP_USER_AGENT}" pattern="(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino" />
- </conditions>
- <!-- 输入要跳转的手机站点 -->
- <action type="Redirect" url="http://m.whsir.com/" redirectType="Found" />
- </rule>
- </rules>
- </rewrite>
- </system.webServer>
- </configuration>
版权声明:文章图片资源来源于网络,如有侵权,请留言删除!!!
评论