locked
Redirects automatically IIS hostname to https RRS feed

  • Question

  • User1077245351 posted

    Hi there,

    I would like to redirect from hostname "example.domain.org" to "https://example.domain.org/ABC/index.aspx"

    See the code below - WebConfig file:

      <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}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
            </rule>
          </rules>
        </rewrite>

    When I type in the URL Browser "example.domain.org" it will display IIS 8 page, but if I type "example.domain.org/ABC/Index.aspx" it redirects to "https://example.domain.org/ABC/Index.aspx" site page.

    I am trying to configure when the online user types "example.domain.org" in URL address browser and automatically redirects to this following address :  "https://example.domain.org/ABC/Index.aspx"

    Please kindly help here.  thanks.

    Wednesday, April 23, 2014 3:07 PM

Answers

  • User-1454326058 posted

    Hi slb2012,

    For your requirement, you could add a new rule to capture example.domain.org to the root website, then redirect or rewrite to the necessary URL.

    Note: You also should add the addition condition to avoid the loop redirect.

    # URL Rewriting Tips and Tricks

    http://ruslany.net/2009/04/10-url-rewriting-tips-and-tricks/

    Thanks

    Best Regards

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, April 24, 2014 5:59 AM

All replies

  • Thursday, April 24, 2014 12:29 AM
  • User1077245351 posted

    Hi anuj_kodal,

    I will try it tomorrow, but so I have IIS hostname called "example.domain.org", I set up the  URL rewrite from hostname into https://example.domain.org/ABC/index.aspx. It works locally and outside of the world doesn't.

    I would like this following URL :  "example.domain.org" to redirect into "https://example.domain.org/ABC/index.aspx".

    Thursday, April 24, 2014 12:52 AM
  • User177399542 posted

    Try global.asax method this will work for you.

    Thursday, April 24, 2014 1:59 AM
  • User-1454326058 posted

    Hi slb2012,

    For your requirement, you could add a new rule to capture example.domain.org to the root website, then redirect or rewrite to the necessary URL.

    Note: You also should add the addition condition to avoid the loop redirect.

    # URL Rewriting Tips and Tricks

    http://ruslany.net/2009/04/10-url-rewriting-tips-and-tricks/

    Thanks

    Best Regards

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, April 24, 2014 5:59 AM
  • User1077245351 posted

    Starain,

    Please give me some example how to add a new rule to capture hostname to the root website and then redirect to the URL  from example.domain.org into example.domain.org/abc/index.aspx

    Sunday, April 27, 2014 2:55 PM
  • User-1454326058 posted

    Hi slb2012,

    To add the rule to the Default Web Site, you could use the IIS manager.

    1. Select Default Web Site
    2. Double click URL Rewrite
    3. Click Add Rule(s)…

    There is a link that may benefit you:

    # URL Rewriting Tips and Tricks

    http://ruslany.net/2009/04/10-url-rewriting-tips-and-tricks/

    On the other hand, if you still have the issue with IIS write, I suggest that you should post it to the IIS forum for efficient response.

    Thanks

    Best Regards

    Tuesday, April 29, 2014 4:16 AM