Rewriting URLs to redirect HTTP requests

I have just updated my old blog site to redirect all the requests to the new one. It has been very easy as the only change to do implies the inclusion of a "rule" in the "rewrite" section of the web.config file. Here is the code:

<!-- Rest of settings -->
	<clear />
    <rule name="Redirect requests from jamuro-blog to jamuro-blognet" stopProcessing="true">
    <match url="(.*)" />  
    <conditions logicalGrouping="MatchAny">
        <add input="{HTTP_HOST}" pattern="^jamuro-blog\.azurewebsites\.net$" />
    <action type="Redirect" url="{R:0}" />  
	<!-- Rest of rules -->
<!-- Rest of settings -->

The rule intercepts all the requests matching a pattern (^jamuro-blog\.azurewebsites\.net$) and then, redirect to the new site as per settings defined in the proper action section.

On the other hand, I updated my configuration in Google Search Console to inform my old site was going to be redirected. It is important for search engines to know it so that you can keep receiving visits properly.


Creating Rewrite Rules for the URL Rewrite Module

Add comment