Here I’m providing short examples with ui rules only. I’ll assume you have some knowledge in URL Rewrite otherwise I’ll suggest you to read official documentation at http://www.iis.net/learn/extensions/url-rewrite-module/using-the-url-rewrite-module
I’m listing below some examples in the form of questions and how to solve them
Outbound rules
Note: in some of the outbound rules precondition responseHtml1 configured as below
1) Add custom script at the end of the response html
2) Add custom script at the beginning of response html
3) Rewrite subdomain with different domain with same URL path and query
Example: I want to rewrite
https://domain1.rajbandi.dev/examples/urlrewrite/domain1.aspx
as
https://domain2.rajbandi.dev/examples/urlrewrite/domain1.aspx
Only domain part is changing, path and query is same.
4) Modify redirect location domain to a different domain with same path and query only when particular words exists.
For example:
Modify response header location if path starting with accounts or customer to different domain
http://www.rajbandi.dev/account/login.aspx or http://www.rajbandi.dev/customer/login.aspx
to
http://www.rajbandi.com/account/login.aspx or http://www.rajbandi.com/customer/login.aspx
5) Remove body onload function in response html
Actual
;Expected
;6) Find all the links with some text and prevent click on them
Actual
Click here to visit rajbandi.dev;
Expected
Click here to visit rajbandi.dev
Alternatively, you can attach some javascript(preventDefault or something) to href
I’ll update more examples asap.