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>
感謝
任何人能幫助嗎? –