Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Caglar 23 posts 94 karma points
    Jul 09, 2021 @ 10:48

    After write the rule, every page is redirected to the error page

    Hi guys,

    I wrote a rule for redirect non-www to www. Now my site goes to www came and that's what I wanted, but whichever page I click on I get to the error page.

    My rule code is below;

      <rule name="Add WWW" stopProcessing="true">
              <match url="^(.*)$" />
                 <add input="{HTTP_HOST}" pattern="^(?!www\.)(.*)$" />
              <action type="Redirect" url="http://www.{C:0}{PATH_INFO}" redirectType="Permanent" />

    For example when I click this link page redirect to error page. Also when I use site without www, there was no problem, all page was working.

  • Huw Reddick 533 posts 1723 karma points
    Jul 09, 2021 @ 14:02
    Huw Reddick

    slightly different to yours, but this is the rule I use

    <rule name="www fixer" stopProcessing="true">
        <match url=".*$" />
        <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
            <add input="{HTTP_HOST}" pattern="www" negate="true" />
            <add input="{HTTP_HOST}" pattern="oftecportaldev" negate="true" />
        <action type="Redirect" url="{REQUEST_URI}" appendQueryString="false" redirectType="Permanent" />
Please Sign in or register to post replies

Write your reply to: