Subdomain Removed From Redirect

I’m setting up a redirect in IIS and I’m having an issue with the subdomain disappearing. Here’s my code:

<rule name="MobDedect" stopProcessing="true">
    <match url=".*" ignoreCase="false" />
    <conditions logicalGrouping="MatchAll">
        <add input="{URL}" pattern="mobile" negate="true" />
            <add input="{HTTP_USER_AGENT}" pattern="midp|mobile|android|iphone|phone" />
            <add input="{HTTP_X-Device-User-Agent}" pattern="midp|mobile|android|iphone|phone" />
            <add input="{HTTP_X-OperaMini-Phone-UA}" pattern="midp|mobile|android|iphone|phone" />
            </conditions>
          <action type="Rewrite" url="mobile/{R:0}" />
        </rule>

Goal
I want to change this: https://test.example.com/ to this: https://test.example.com/mobile/

Problem
I can’t post more than 2 links to illustrate this, but with my code, the redirect goes directly to example.com/mobile and removes the test subdomain.

Related:

Leave a Reply