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


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

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

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.