1

I'm trying to use URL rewrite with IIS7 to make mydomain.com/home/default.aspx look like mydomain.com. Additionally, the original structure of the site has the root default.aspx redirecting to mydomain.com/home/default.aspx.

Thus, visits to mydomain.com would redirect to mydomain.com/home/default.aspx while showing only mydomain.com in the web browser address bar.

Can someone help me with the Inbound and Outbound rules to make this happen?

Thank you.

6
  • Have you tried something? Do you want anything coming to mydomain.com being rewritten to mydomain.com/home/? Commented Feb 14, 2013 at 19:36
  • @cheesemacfly Well, I'm quite new to this but I have tried several things. The page I need to display is mydomain.com/home/default.aspx but what I want to show in the address bar is just mydomain.com.
    – bham3dman
    Commented Feb 14, 2013 at 20:40
  • You want all your urls to be rewritten or only the home page? Commented Feb 14, 2013 at 20:43
  • @cheesemacfly Only the home page.
    – bham3dman
    Commented Feb 14, 2013 at 20:44
  • So what you want is when someone hits mydomain.com the url is rewritten to mydomain.com/home/default.aspx? What if the user hits mydomain.com/about? Commented Feb 14, 2013 at 20:46

1 Answer 1

1

Run the iis manager (inetmgr), select your website -> double click on URL rewrite.
You then have to click on the right on Add Rule(s)... and choose Blank Rule.
Fill up the fields with the following values: Rewrite rule

This rule will match mydomain.com or mydomain.com/ and rewrite it to mydomain.com/home/default.aspx.

This will produce the following rule in your web.config:

<rules>
    <rule name="test" stopProcessing="true">
        <match url="^/?$" negate="false" />
        <action type="Rewrite" url="home/default.aspx" />
    </rule>
</rules>
1
  • Thank you. I now have a better understanding of how this works. I had to remove my server redirect via code and then what you provided worked great.
    – bham3dman
    Commented Feb 26, 2013 at 22:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.