Programming Newbie February 2016

HTTPS redirect on sub application

I have an application with this domain Portal is a sub application to the main application ( on IIS.

I would like to redirect to if anyone access it by

I added these lines to the web.config:

       <rule name="HTTPS Redirect" enabled="true">
           <match url="(.*)" ignoreCase="false" />
               <add input="{HTTPS}" pattern="off" />
           <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" />

After this, if I call site, it takes me to and not to

Do you guys have any idea how can I make this work?



Josh February 2016

Try changing your rule to:

<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}/{R:1}" />

Also, if the /example subdirectory is an application, make sure these rewrite rules are placed in that web.config and not the parent application's web.config.

Post Status

Asked in February 2016
Viewed 3,256 times
Voted 13
Answered 1 times


Leave an answer