• 1-888-289-2246
  • 24x7x365 Presence

How to redirect http to https in IIS7.5


If you ever want to force your http traffic to https on IIS7 you can do the steps below. The steps here have been obtained after going through various forums and links which we tested and tried out. This worked for us so we’re putting it up here for everyone.

How to redirect HTTP traffic to HTTPS on IIS7.

1. In IIS, click on the site name, and go to the SSL Settings section.

2. Check Require SSL and Require 128-bit SSL and click Apply.




4. Create a new text file and paste the following into it:


Redirecting…




5. Save the file as redirectToHttps.htm in your C:\Inetpub directory.

6.Back in IIS, click on the site name and double-click the Error Pages option.

7. Click Add… and enter 403.4 as the Status code. Browse for the redirectToHttps.htm file you just created and click OK.

8. Select the error code and press Edit Feature Settings…

9. Click the Custom error pages option and again browse for the redirectToHttps.htm file.

Here if you get an error in IIS saying “Lock violation” then you need to do the steps below.

a. Open the file %windir%\System32\inetsrv\config\applicationHost.config in Notepad. Run Notepad as the administrator if you’re having problems.

You’ll see something like this:

Remove the ,defaultPath section and save.

b. Also in the web.config file which is now created in your website root you will have to change the path from absolute to virtual
e.g.
Change below from

To

Now save the web.config.

10. Test the site by going to http://www.yoursite.com and making sure it redirects


]]>


Leave a Reply

Your email address will not be published. Required fields are marked *