URL Rewriting and mobile URL rewriting

I have a site (.net) and want to configure URL rewriting, so that for desktop:


rewrites to


and for mobile it simply appends the subdomain: http://m.domain.com/category/content/23

All my mobile files are under a directory "mobile".

I have manged to sort out the desktop url rewriting, but can't get mobile one working. For desktop I have the following rule:

    <rule name="rewrite_rule">
              <match url="(\d*)/content/(\d*)" />
                <add input="{HTTP_HOST}" pattern="domain\.com" />
              <action type="Rewrite" url="content.aspx?pageid={R:2}" appendQueryString="true" />

and for mobile I have:


    <rule name="rewrite_rule2">
              <match url="/content/(\d*)" />
                <add input="{HTTP_HOST}" pattern="^m\.domain\.com" />
              <action type="Rewrite" url="/mobile/content.aspx?pageid={R:1}" appendQueryString="true" />

but if I type in URL with mobile subdomain, it takes me to the desktop version, i.e. my desktop rule is fired instead of mobile one.

please help.

Who is Participating?

Improve company productivity with a Business Account.Sign Up

Praveen DMConnect With a Mentor Infra Team LeadCommented:
Try creating the subdomain separately and try 302 redirect with URL rewrite rule for mobile.
pritamwAuthor Commented:
Sorry, i dont follow. "subdomain separately" as in a separate website? thanks
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.