简体   繁体   English

使用IIS7将“/”重定向到“/ web”

[英]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. 我正在托管一个网站,我希望各种原因让http://mydomain.com自动重定向到http://mydomain.com/web,同时仍允许http://mydomain.com/foo .html将被送达。

Using HTTP Redirect from IIS 7 I seem to be creating an endless redirect loop. 使用IIS 7中的HTTP重定向我似乎正在创建一个无限的重定向循环。 Would you have any hints for me? 你能给我一些提示吗?

Give URL Rewrite Module a try. 尝试提供URL重写模块。 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 http://www.tugberkugurlu.com/archive/remove-trailing-slash-from-the-urls-of-your-asp-net-web-site-with-iis-7-url-rewrite-module

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM