开发者

How can i configure in web.config a 301 permanent redirect?

I would love to use web.config to do the 301 redirection from an old domain to another. How could i do that?

In your answers, please keep in mind that the IIS is v7 and

i would not like to use any 3rd party dll's like urlrewriteing.net etc or use ASP.NET code or configure the IIS,for that.

I am sure this can be done, but how?

UPDATE: I tried the a开发者_高级运维nswer of Parvesh's but i have a feeling the is not "officially" supported OR i am making something else terribly wrong.


you will need the URL rewriting module installed under IIS and then you can use this in side web.config.

<configuration>
<system.webServer>
<rewrite>
  <rules>
    <rule name="Redirect to WWW" stopProcessing="true">
      <match url=".*" />
      <conditions>
        <add input="{HTTP_HOST}" pattern="^domain.com$" />
      </conditions>
      <action type="Redirect" url="http://www.domain.com/{R:0}"
           redirectType="Permanent" />
    </rule>
  </rules>
</rewrite>
</system.webServer>
</configuration>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜