Azure-docs: Redirect to a custom directory - Multiple domains?

Created on 29 Mar 2019  Â·  7Comments  Â·  Source: MicrosoftDocs/azure-docs

Referencing the content under the heading "Redirect to a custom directory", is it possible to map different DNS records (A or CNAME or whatever is supported for the scenario) to different custom directories that are mapped under the "Virtual applications and directories" section?

For example, I'd like to:

contoso.com -> \site\wwwroot
blogs.contoso.com -> \site\blogs
cms.contoso.com -> \site\admin-portal

Is this possible?


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

app-service-wesvc cxp product-question triaged

All 7 comments

@sujayvsarma
Thanks for your feedback! We will investigate and update as appropriate.

Do you have a response for this yet?

I am also interested in this type of configuration.

@sujayvsarma and @cratace Thank you for your interest. I believe the below information should accomplish your ask.

Goal:
siteA.contoso.com pointing to \ wwwroot \ SITEA
siteB.contoso.com pointing to \ wwwroot \ SITEB

I tested this out on my end :

  • I created a test site with two folders SiteA and SiteB and added some content in it
  • I then went to DNS registrar and added these subdomains
  • I added those subdomains in the Azure Portal

I used URL Rewrite option to create rule for my site . You can use the same settings in your Web.Config file :

<system.webServer>
        <rewrite>
            <rules>
                <rule name="SiteARule" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTP_HOST}" pattern="sitea.mahuss.com" />
                    </conditions>
                    <action type="Rewrite" url="sitea/{R:0}" />
                </rule>
                <rule name="SiteBRule" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTP_HOST}" pattern="siteb.mahuss.com" />
                    </conditions>
                    <action type="Rewrite" url="siteb/{R:0}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>

After doing this , I went ahead and tested this out and it is working as expected

SiteA.contoso.com is going to wwwroot\SiteA folder
SiteB.contoso.com is going to wwwroot\SiteB folder

We will now proceed to close this thread. If there are further questions regarding this matter, please tag me in your reply. We will gladly continue the discussion and we will reopen the issue.

@BryanTrach-MSFT Just one question -- How do I now publish to the SiteA / SiteB folders from Visual Studio ?

Thats great. Thanks @BryanTrach-MSFT

@sujayvsarma I believe the below 3rd party blog should help.

https://dotnetthoughts.net/deploying-multiple-application-in-webapp/

Was this page helpful?
0 / 5 - 0 ratings