asp.net - HTTPS redirect on sub application -
i have application domain http://abc.example.com/portal. portal sub application main application (abc.example.com) on iis.
i redirect https://abc.example.com/portal if access http://abc.example.com/portal.
i added these lines web.config:
<rewrite> <rules> <rule name="https redirect" enabled="true"> <match url="(.*)" ignorecase="false" /> <conditions> <add input="{https}" pattern="off" /> </conditions> <action type="redirect" url="https://{http_host}/{r:1}" appendquerystring="true" redirecttype="permanent" /> </rule> </rules> </rewrite>
after this, if call site http://abc.example.com/portal, takes me https://abc.example.com/ , not https://abc.example.com/portal.
do guys have idea how can make work?
thanks,
try changing rule to:
<action type="redirect" url="https://{http_host}{request_uri}/{r:1}" />
also, if /example subdirectory application, make sure these rewrite rules placed in web.config , not parent application's web.config.
Comments
Post a Comment