Knowledgebase

HTTP to HTTPS Redirection in IIS with URL Rewrite Print

  • 0

Why Redirect to HTTPS

Once an SSL certificate is installed on your IIS website, visitors can still reach the insecure HTTP version unless you redirect them. A proper 301 redirect protects login pages, keeps search engine rankings consolidated on one address, and removes browser warnings for your customers.

Step 1: Install the URL Rewrite Module

URL Rewrite is a free Microsoft add-on for IIS. Download it using the Web Platform Installer or from the Microsoft IIS downloads page, run the installer, then close and reopen IIS Manager. You should now see a URL Rewrite icon when you select your site.

Step 2: Create the Redirect Rule

  1. In IIS Manager, select your website and open URL Rewrite.
  2. Click Add Rule and choose Blank rule under Inbound rules.
  3. Name the rule Redirect to HTTPS.
  4. Set Requested URL to Matches the Pattern and enter (.*) as the pattern.
  5. Under Conditions, click Add. Set the condition input to {HTTPS}, choose Matches the Pattern, and enter ^OFF$.
  6. Under Action, choose Redirect. Set the redirect URL to https://{HTTP_HOST}/{R:1} and the redirect type to Permanent 301.
  7. Click Apply on the right side.

Step 3: Test

Browse to the plain HTTP address of your site. The browser should immediately move to the HTTPS address with a padlock. Test both the bare domain and the www version. Clear your browser cache if you tested redirects earlier, because browsers remember 301 responses.

Common Problems

  • Redirect loop. This usually happens behind a proxy or load balancer. Contact support so we can adjust the rule to check forwarded headers.
  • Rule missing after deployment. The rule lives in web.config, so make sure your deployment process does not overwrite it.

Our team can configure this for you. Open a ticket from app.techguru.co.in with your server details.


Was this answer helpful?
Back