Creating Web.config redirect rule for wordpress site on Azure IIS that includes page-to-page redirects

Lisa Nichols 1 Reputation point
2021-04-06T21:01:48.363+00:00

HELP!

We just changed the URL on our Azure hosted website. The old home page redirects correctly, BUT none of the subpages are redirecting. Instead of newsite.com/contact-us....you can type in oldsite.com/contact-us and it does not redirect.

There is a Web.config file that has wildcard code in it, but It doesn't seem to be helping. I have inserted it below. What I am doing wrong!!!!!!

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
   <rewrite>
      <rules><rule name="redirect" stopProcessing="true"><match url="."/><conditions>
<add input="{HTTP_HOST}" pattern="servername.azurewebsites.net$"/></conditions>
<action type="Redirect" url="http://www.newsite.com/{R:1}" redirectType="Permanent"/></rule>
           <rule name="wordpress" patternSyntax="Wildcard">
               <match url="
"/>
                   <conditions>
                       <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
                       <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
                   </conditions>
               <action type="Rewrite" url="index.php"/>
           </rule></rules>
   </rewrite>
 
</system.webServer>
</configuration>

Internet Information Services
{count} votes