Custom pages redirect error of non www to www of wordpress site developed from microsoft azure

I have added this code in web.config of my wordpress site:

<rule name="Redirect to WWW site">
  <match url=".*" />
      <conditions logicalGrouping="MatchAny">
        <add input="{HTTP_HOST}" pattern="^(www.)(.*)$" negate="true" />
      </conditions>
  <action type="Redirect" url="http://www.{HTTP_HOST}/{R:0}" redirectType="Permanent" />
</rule>

This perfectly works for redirection like homepage, default wordpress url(login.php, wp-admin). Examples:

  1. If I go to link poudelmadhav.com it redirects to www.poudelmadhav.com
  2. If I go to link poudelmadhav.com/wp-login.php it redirects to www.poudelmadhav.com/wp-login.php

But this doesnot work in custom pages of wordpress that I have created after installing wordpress. For examples:

  1. If I want to go poudelmadhav.com/contact it redirects to www.poudelmadhav.com not www.poudelmadhav.com/contact
  2. If I want to go poudelmadhav.com/about-me it redirects to www.poudelmadhav.com not www.poudelmadhav.com/about-me

I have followed the instructions from here.
How can I solve this please help me.

Read more here: Custom pages redirect error of non www to www of wordpress site developed from microsoft azure

Leave a Reply

Your email address will not be published. Required fields are marked *