I need to rewrite rules for MVC app that created in IIS sub folder (www.example.com/test/App is application root)
Rewrite rules will redirect non-www request to www and http request to https
Cases:
A) Will be redirect to: https://www.example.com/test/App/Controller
1) http://www.example.com/test/App/Controller
2) example.com/test/App/Controller
3) www.example.com/test/App/Controller
B) Will be redirect to: https://www.example.com/test/App
1) http://www.example.com/test/App
2) example.com/App
3) www.example.com/test/App
I tried routings below, but these are not redirects cases under A section.
Is there any rule or rules for achieve both A and B cases?
<rule name="Redirect to WWW" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^example.com$" />
</conditions>
<action type="Redirect" url="http://www.example.com/{R:0}" redirectType="Permanent" />
<rule name="Redirect to WWW https" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTPS}" pattern="^example.com$" />
</conditions>
<action type="Redirect" url="https://www.example.com/{R:0}" redirectType="Permanent" />