Quantcast
Channel: URL Rewrite Module
Viewing all articles
Browse latest Browse all 2482

Asp.net area to subdomain

$
0
0

Hi there,

I just developed mobile version of one of my websites. It's build using asp.net mvc and for the mobile site I decided to go with asp.net mvc area and named mobile.

Currently users access mobile version by navigation mysite.com/mobile/.
I'm trying to set a rule so it "maps" mysite.com/mobile to mobile.mysite.com.

What I've done till now:

1. I've a rule to redirect mysite.com to www.mysite.com and it's working
   <rule name="CanonicalHostNameRule1">
    <match url="(.*)" />
    <conditions>
     <add input="{HTTP_HOST}" pattern="^www\.mysite\.com$" negate="true" />
    </conditions>
    <action type="Redirect" url="http://www.mysite.com/{R:1}" />
   </rule>

2. I've already have a dns record for mobile.mysite.com

3. On IIS I bound mobile.mysite.com to my iis site

4. I've tried adding this rule, but it doesn't redirect mysite.com/mobile to mobile.mysite.com
<rule name="MobileRedirect">
    <match url=".*" />
    <conditions>
        <add input="{HTTP_HOST}" pattern="^mobile\.mysite\.com$" />
        <add input="{URL}" pattern="^mobile/" negate="true" />
    </conditions>
    <action type="Rewrite" url="/mobile/{R:0}" />
</rule>

Note that my url can be like this mysite.com/mobile/34/some-title and this one should be redirected to mobile.mysite.com/34/some-title

My server:Windows Server 2008 r2
IIS 7.5

Thanks!


Viewing all articles
Browse latest Browse all 2482

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>