Actualités développement .NET

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

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> :

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

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 !