将域重定向到IIS 7中的移动版本

将域重定向到IIS 7中的移动版本,iis,rewrite,Iis,Rewrite,我一直在寻找这个问题的答案,但我仍然很难弄清楚如何做到这一点 我的公司为人们建立了许多网站。我们的一位客户有一个网站example.com 并且想要一个手机版的。m、 example.com 我将m添加为DNS别名 我还向主索引文件添加了一些JS <if (screen.width <=800) {window.location ="http://example.com/mobile_site/index.html";} 我修复了它,不得不创建一个单独的站点,指向iis中的文件夹。

我一直在寻找这个问题的答案,但我仍然很难弄清楚如何做到这一点

我的公司为人们建立了许多网站。我们的一位客户有一个网站example.com

并且想要一个手机版的。m、 example.com

我将m添加为DNS别名

我还向主索引文件添加了一些JS

<if (screen.width <=800) {window.location ="http://example.com/mobile_site/index.html";}

我修复了它,不得不创建一个单独的站点,指向iis中的文件夹。不需要重定向脚本。只有Javascript代码

有人能帮忙吗?
<rewrite>
<rewriteMaps>
<rewriteMap name="mobile rewrite">
<add key="example.com\mobile_site\index.html" value="m.example.com"/>
</rewriteMap>
</rewriteMaps>
<rules>
<rule name="Rewrite rule1 for mobile rewrite">
<match url=".*"/>
<conditions>
<add input="{mobile rewrite:{REQUEST_URI}}" pattern="(.+)"/>
</conditions>
<action type="Rewrite" url="{C:1}" appendQueryString="false"/>
</rule>