Attached code snippet is working for WebApi application (hosted in IIS 8.5 / 10) but it is not working for sitecore 8.2 application which hosted in same IIS server. Rather always displays Sitecore error page. Any suggestion please?
Additional info more elaborated,
When user hits https://Testing.com/wl/pages/TermsAndCondition, it should redirect to https://Testing.com/TermsAndCondition
It is working with URL Rewrite but with below url
https://Testing.com/TestApp/wl/pages/TermsAndCondition
where TestApp is set as StartItem in SiteDefinition.config but actual end user URL will be the very first one which always redirects to sitecore error page
It looks like the regular expression is not matching correctly.
Try changing <match url="[0-9a-z]/wl/pages/[0-9a-z]" />
to <match url="([0-9a-z]*/)?wl/pages/[0-9a-z]*" />
You can test by clicking the Test pattern button, you can see whether the path you entered can be matched successfully.