1

I need to redirect all HTTP requests to HTTPS with a subdirectory. Currently all requests that go to http://example.org needs to be redirected to https://example.org/subdirectory. As an example: https://example.org/subdirectory needs to redirect to the root directory.

I'm using IIS v10 and also installed URL Rewrite.

1 Answer 1

1

Add the following rewrite rules in web.config file and check.

<system.webServer> <rewrite>
    <rules>
     <clear />
          <rule name="Redirect to https" stopProcessing="true">
              <match url=".*" />
              <conditions>
                  <add input="{HTTPS}" pattern="off" ignoreCase="true" />
              </conditions>
            <action type="Redirect" url="https://{HTTP_HOST}/subdirectory" redirectType="Permanent" appendQueryString="false" />
         </rule>
    </rules>
 </rewrite>
</system.webServer>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.