0
我一直在寻求这个问题的答案,但我仍然有问题搞清楚如何做到这一点的移动版本。重定向域在IIS 7
我公司主机许多网站的人。我们的一个客户有一个网站example.com
,并希望它的移动版本。 m.example.com
我添加米到作为DNS别名
我还添加了一些JS到主索引文件。
<if (screen.width <=800) {window.location ="http://example.com/mobile_site/index.html";}
成功显示该网站的移动版本。
但我想的网站是m.example.com
(注:我本来的JS点m.example.com刚刚导致IIS页)
所以这是我有点失落的地方。在IIS面板我看到URL重写的选项。
我创建了一个叫做移动重写
与原始值的重写映射= example.com/mobile_site/index.html 新值= m.example.com
然后我设定重写映射规则指出这一点。
这并没有工作,所以我在这里,因为我不知道自己能做什么,或者如果我没有理解错了。
下面是web.config文件输出
<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>
感谢
任何人能帮助吗? –