To configure an HTTPS redirect using IIS, follow these steps:
- Enable URL Rewrite Module: Ensure the "URL Rewrite" module is enabled in IIS.
- Create a New Redirect Rule:
- Name: Enter a name for your rule (e.g., "HTTPS Redirect").
- Action Type: Select "Redirect".
- Set Match URL: Use
'*'or(.*)to match all incoming requests. - Add Condition:
- Input String:
{HTTPS} - Pattern:
^OFF$ - This condition triggers the redirect when HTTPS is not present (i.e., when using HTTP).
- Input String:
- Redirect URL: Set to
https://{HTTP_HOST}{REQUEST_URI}to maintain the correct domain and path. - Redirect Type: Choose "Permanent" (301) for a permanent redirect, beneficial for SEO.
- Append Query String: Check the box to preserve existing query parameters during redirection.
- Apply Changes: Save the rule and test by accessing your site via HTTP to ensure it redirects correctly to HTTPS.
- Verify Configuration:
- Check the
web.configfile in the document root for the XML configuration. - If missing, create a new file with the necessary XML content.
- Check the
