Link to home
Start Free TrialLog in
Avatar of Member_2_6109592
Member_2_6109592

asked on

IIS rewrite rules for subsites as subfolders but not all

IIS (Win2012R2) site instance that needs to be partially redirected. This one's a challenge...

oldsite.com (root) > newsite.com
oldsite.com/PathA > newsite.com
oldsite.com/specialPath1 is not redirected at all (there are 4 of these)
oldsite.com/anythingElse > newsite.com/anythingElse

Started off by using match
^(PathA|PathB|PathC)$

Open in new window

which redirects to URL: http://newsite.com (append query string is not selected)

This works as expected from what I can tell

Then added next rule with match
^(specialPath1|specialPath2|specialPath3|specialPath4)/.*$

Open in new window

with action type None & Stop processing of subsequent rules - thinking it would just stay on the site

Then finally added rule with match
(.*)

Open in new window

and conditions
^(www.)?oldsite\.com(.*)

Open in new window

set to redirect to URL: http://newsite.com/{R:0} (append query string is selected)

The overall output is working with ONE major exception... this is Hosting Drupal and specialPath1 (2, 3 and 4) are sub-sites. Those subsides don't work because the root directory (this themes, etc) isn't available anymore. Its interpreting the path as literal, so when entering URL oldsite.com/specialPath1, it's giving me missing directory error.


Then I disabled above three rules and created one rule:

Sent request URL "does not match the pattern ^(specialPath1|specialPath2|specialPath3|specialPath4)), no added conditions, and redirect URL is http://newsite/com/{R:0}  (append query string is selected)

The specialPath1 site works, but anytime redirected is missing the substring, so oldsite.com/anything is being passed to root of newsite.com

Odd situation, but there something I'm missing or simpler approach?
ASKER CERTIFIED SOLUTION
Avatar of Member_2_6109592
Member_2_6109592

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial