在windows2008下配置II7 web.config
当通过手机访问www域名时,自动跳转到对应的移动域名下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
<?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> |
原文链接:IIS7判断pc和移动跳转,转载请注明来源!
感受学习的力量!