URL Redirect/Rewrite when opened from Mobile Browser
iis-7, redirect, url-rewriting
Solution
You can use the `{HTTP_USER_AGENT}` condition to do this. Applied to your case, it would be as follow:
<rule name="Mobile Redirect" stopProcessing="true">
<match url="^home/Account/$" ignoreCase="true" />
<conditions logicalGrouping="MatchAny" trackAllCaptures="false">
<add input="{HTTP_USER_AGENT}" pattern="midp|mobile|phone" />
<add input="{HTTP_X-Device-User-Agent}" pattern="midp|mobile|phone" />
<add input="{HTTP_X-OperaMini-Phone-UA}" pattern="midp|mobile|phone" />
</conditions>
<action type="Redirect" url="http://m.testresponce.com/mforyourhome/Account.aspx" appendQueryString="false" />
</rule>
It will match exactely `home/Account/` and if the user is browsing from a mobile device, he/she will be redirected to `http://m.testresponce.com/mforyourhome/Account.aspx`
Important
Apply this rule on `http://testrequest.com/` only (or at least avoid being stuck in an infinite redirect). User agent are never 100% reliable (since they can be changed)
Source: http://forums.iis.net/t/1169853.aspx
Problem
We are working on two website, where one is webapplication and another is mobile application. So my requirement is to create a redirection url to redirect from webapplication to mobile application for mobile users but the folder or structure is different. For Web Application it's http://testrequest.com/home/Account/ and for mobile it should be http://m.testresponce.com/mforyourhome/Account.aspx Please can someone help me on using the URL Rewrite. Edited:- Working on IIS7