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
    Caglar
    0

    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 http://www.abcd.com.tr 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="^(.*)$" />
              <conditions>
                 <add input="{HTTP_HOST}" pattern="^(?!www\.)(.*)$" />
              </conditions>
              <action type="Redirect" url="http://www.{C:0}{PATH_INFO}" redirectType="Permanent" />
       </rule>
    

    For example when I click this link http://www.abcd.com.tr/tr-tr/deneme/test/ page redirect to error page. Also when I use site without www, there was no problem, all page was working.

  • Huw Reddick 1929 posts 6697 karma points MVP 2x c-trib
    Jul 09, 2021 @ 14:02
    Huw Reddick
    0

    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" />
        </conditions>
        <action type="Redirect" url="https://www.oftec.org{REQUEST_URI}" appendQueryString="false" redirectType="Permanent" />
    </rule>
    
Please Sign in or register to post replies

Write your reply to:

Draft