2
我們使用IIS URL重寫模塊通過檢查HTTP_USER_AGENT將所有請求從移動瀏覽器重定向到m.mymobilesite.com。這工作正常,現在我們需要實現一個「查看完整網站」鏈接,這將允許用戶看到主站點。嘗試通過添加「nomobile」cookie來實現這一點,當用戶點擊「View Full Site」鏈接時,該鏈接將被規則驗證並否定。出於某種原因,我的規則似乎並不奏效。帶有「nomobile」cookie的移動設備的IIS URL重寫規則
請幫忙。
<rewrite>
<rules>
<rule name="MobileRedirect" patternSyntax="ECMAScript" stopProcessing="true">
<match url=".*" ignoreCase="true" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_COOKIE}" pattern="nomobile" ignoreCase="true" negate="true" />
<add input="{HTTP_USER_AGENT}" pattern="android|blackberry|googlebot-mobile|iemobile|iphone|ipod|opera mobile|palmos|webos" />
</conditions>
<action type="Redirect" url="http://m.mymobilesite.com" appendQueryString="false" redirectType="Found" />
</rule>
</rules> </rewrite>