Florian Doyon
Florian Doyon

Reputation: 4186

Redirect “/” to “/web” using IIS7

I'm hosting a site where I would like for various reasons to have http://mydomain.com automatically redirect to http://mydomain.com/web while at the same time still allowing http://mydomain.com/foo.html to be served.

Using HTTP Redirect from IIS 7 I seem to be creating an endless redirect loop. Would you have any hints for me?

Upvotes: 1

Views: 271

Answers (1)

tugberk
tugberk

Reputation: 58474

Give URL Rewrite Module a try. Following code should work for you :

<rewrite>
  <rules>

    <rule name="Redirect example.com to example.comn/web" patternSyntax="ECMAScript" stopProcessing="true">
        <match url="^$" />
        <action type="Redirect" url="/web" />
    </rule>

  </rules>
</rewrite>

How you can get start with Rewrite Module is briefly documented on below post :

http://www.tugberkugurlu.com/archive/remove-trailing-slash-from-the-urls-of-your-asp-net-web-site-with-iis-7-url-rewrite-module

Upvotes: 3

Related Questions