HELP! URL rewrite

Discussion in 'Domain names / DNS' started by sabmah, Jul 8, 2014.

  1. I have my website hosted on discountasp as example - foo.com . The website is under the root directory. So I can easily go with foo.com/fooapp

    I have a domain name registered www.bar.com and I already used the domain pointer to add the domain.

    Now, whenever I type www.bar.com, I want it to display foo.com/fooapp without changing the addressbar URL.

    I am new to URL Rewrite. Please help.

    I've tried to use these recommended websites
    http://weblogs.asp.net/owscott/iis-url-rewrite-hosting-multiple-domains-under-one-site
    http://blog.discountasp.net/url-rewrite-2-0-for-iis-7-is-here/

    Thanks in advance
     
  2. FrankC

    FrankC DiscountASP.NET Staff

    sounds like you want to simply redirect your domain pointer to your site, is that correct?
     
  3. Yes, but I want the url to still say www.bar.com instead of foo.com/fooapp

    I have a domain pointer www.bar.com
    I already pointed nameservers at www.bar.com to discountasp.net
     
    Last edited: Jul 8, 2014
  4. FrankC

    FrankC DiscountASP.NET Staff

    This should do it for you

    <rewrite>
    <rules>
    <rule name="bar.com" stopProcessing="true">
    <match url=".*" />
    <conditions>
    <add input="{HTTP_HOST}" pattern="^(www.)?bar.com" />
    <add input="{PATH_INFO}" pattern="^/fooapp/" negate="true" />
    </conditions>
    <action type="Redirect" url="\fooapp\{R:0}" />
    </rule>
    </rules>
    </rewrite>
     

Share This Page