Actualités développement .NET

Actualités DotNetNuke Pro et Communitaire et autres technologies mises en oeuvre par DevPCI.

How to redirect in a very easy way .PHP to .ASPX url in DNN ?

With the IIS URL Rewrite Module available from IIS7, you can include in your web.confg some very easy rewrites rules to redirect any kind of old urls to your new urls :

1. Download and install the URL Rewrite Module for IIS (make sure you got the URL Rewrite icon in your iis setup website)

2. In your DotNetNuke Web.Config file, add this settings in the <system.webServer> :

      <rewriteMap name="Redirects">  
        <add key="/index.php" value="/Home.aspx" />  
        <add key="/AboutUs.jsp" value="/AboutUs.aspx" />
        <add key="/otheroldurl" value="/othernewurl" />  
      <rule name="Redirect rule1 for Redirects">  
        <match url=".*" />  
          <add input="{Redirects:{REQUEST_URI}}" pattern="(.+)" />  
        <action type="Redirect" url="{C:1}" appendQueryString="false" />  

3. Change the "add key" rules as you need, and save your web.config file.

4. Now all the rules are redirecting old urls to new ones as a permanent redirect !

That's all !