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 answer 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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With