I hosted my ASP.NET MVC site based on SSL authentication as https://example.com.
If user navigate to http://example.com it should automatically redirect to https://example.com.
Is there any possible way to do this.
Asked
Active
Viewed 126 times
0

Clinton Prakash
- 967
- 9
- 20
-
Can anybody help how to do the same thing in JSP servlet page? – Clinton Prakash Oct 06 '17 at 09:35
1 Answers
1
Install the URL Rewrite module and add the below to your web.config in system.webserver
:
<rewrite>
<rules>
<rule name="Redirect to HTTPS" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" />
</rule>
</rules>
</rewrite>