I want to redirect some pages from the old website (oldsite.com) to the new website (newsite. *) In accordance with the following rules:
- All first level children (/ sv, / no, / da, etc.) should redirect their respective copies, i.e. newsite.se, newsite.no, newsite.dk, etc.
- All other children / descendants should also be redirected to the root of the new sites except / page1 and / page 2 and its descendants.
For this, I created the following rules (for sv in this case):
<rule name="Redirect /sv to .se" stopProcessing="true"> <match url="^sv/?$" /> <action type="Redirect" url="http://newsite.se" /> </rule> <rule name="Redirect /sv/* except some pages" stopProcessing="true"> <match url="^sv/.+" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_URI}" pattern="^sv/page1(.*)" negate="true" /> <add input="{REQUEST_URI}" pattern="^sv/page2(.*)" negate="true" /> </conditions> <action type="Redirect" url="http://newsite.se" /> </rule>
The first rule works fine, but not the second. The problem is that my negative conditions do not seem to work. When I log in to oldsite.com/sv/page1, I still get redirected to newsite.se. Perhaps I misunderstood how the negative conditions work, but it does not follow that the second rule performs the action if and only if both conditions are true (evaluated as false), i.e. Does REQUEST_URI not match match / page1 and / page2?
source share