IIS RedirectRSS

4 replies

Last post Jan 30, 2021 05:04 PM by AlexNap

  • IIS Redirect

    Jan 22, 2021 06:33 PM|AlexNap|LINK

    Hi, 

    my scenario is:

    www.example.com > associated main site

    crm.example.com > associated crm environment

    admin.example.com > associated admin environment

    I would like that all other random subdomains:

    site1.example.com

    site2.example.com

    site3.example.com

    sitex.example.com..

    were redirect or managed to a dedicated other site.

    Is it possible on IIS?? 

    Thanks a lot.

  • Re: IIS Redirect

    Jan 25, 2021 02:54 AM|Brucz|LINK

    Hi AlexNap,

    Do you want to www rewrite to a main site, crm to crm environment site, admin to admin environment site, and other to a specific site?

    You can use HTTP_HOST to determine whether the domain name meets the conditions, and then rewrite or redirect to the destination URL.

    <add input="{HTTP_HOST}" pattern="^(www\.)example.com$" />
    <add input="{HTTP_HOST}" pattern="^(crm\.)example.com$" />
    <add input="{HTTP_HOST}" pattern="^(admin\.)example.com$" />
    

    If other random subdomains are regular, you can use regular expressions to judge, or if you know the complete domain name, you can use rewriteMap to map to the target URL.

    Best regards,

    Brucz

    .NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
  • Re: IIS Redirect

    Jan 25, 2021 09:54 AM|AlexNap|LINK

    Hi Brucz,

    thanks a lot!

    Www, crm and admin are already configured  with their sites in IIS. 

    The problem are inbound requests of random subdomain that must be managed from a dedicated site.

    I don’t think I can rewriteMap.

    Thanks for your replies

  • Re: IIS Redirect

    Jan 28, 2021 09:12 AM|Brucz|LINK

    Hi AlexNap,

    If you know the regular of those random subdomian name, you can use regular expressions to judge and rewrite them.

    Best regards,

    Brucz

    .NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
  • Re: IIS Redirect

    Jan 30, 2021 05:04 PM|AlexNap|LINK

    Hi, 

    Have you an example for me?

    Thanks a lot

    Ales