none
[PHP][Web Apps] Add Multiple Domains to one single Web App via code RRS feed

  • Question

  • I have a PHP App running on my Azure. I want my customers to be able to use my application on their own domains. Is it possible to add multiple domains to one single web application? Is there an API or something to add domains to a web app programatically?



    Friday, June 3, 2016 8:44 PM

Answers

  • If I do not misunderstand your question, you want to manage multiple domains directing to your one Azure Web App application. E.G. manage domain1.com and domain2.com to the same yourapp.azurewebsites.net.

    You can let your customer to add a CName of your azure application on his own DNS manage server.enter image description here

    Then, scale up your application's app service plan to at leaset share tier. And in CONFIGURE tab of your Azure Web App's portal page, under domain names section, add yor custom's domain into the list. E.G. enter image description here

    Any further concern, please feel free to let me know.

    Monday, June 6, 2016 5:21 AM
    Moderator

All replies

  • Hello,

    Thank you for posting here!

    Yes, you can add multiple domains to one single web app, please refer this article, which describes about “Hosting multiple domains under one Azure Website”.

     This is not possible when you use the free Windows Azure websites.

    And also, you can use Wildcard Domain to add multiple sub-domain to a web app. Kindly refer the article for more details.

    Reference: http://stackoverflow.com/questions/18730806/add-a-domain-to-an-azure-web-site-via-code

    Hope this helps.

    Regards,

    Swikruti

    If a post answers your question, please click Mark as Answer on that post and Vote as Helpful.
    Saturday, June 4, 2016 11:53 AM
  • Thank you for your response.

    I did. But It doesn't work. It says "Error 404 - Web app not found".

    I'm sure that my web.config is in right place and works.

    Sunday, June 5, 2016 7:40 AM
  • Deleted
    Sunday, June 5, 2016 10:10 AM
  • I've exactly done this. A blue page says:

    "Error 404 - Web app not found.

    The web app you have attempted to reach is not available in this Microsoft Azure App Service region. This could be due to one of several reasons:

    1. The web app owner has registered a custom domain to point to the Microsoft Azure App Service, but has not yet configured Azure to recognize it. Click here to read more.

    2. The web app owner has moved the web app to a different region, but the DNS cache is still directing to the old IP Address that was used in the previous region. Click here to read more."

    My domain poins to my Azure but my web app cannot catch the domain. This is how my web.config looks like:

    <?xml version="1.0"?>
    <configuration>
    
      <system.webServer>
        <rewrite>
          <rules>
     
    			
    			 <rule name="mailraid.com" stopProcessing="true">
              <match url="(.*)" />
              <conditions>
                <add input="{HTTP_HOST}" pattern="^(www.)?mailraid.com" />
                <add input="{PATH_INFO}" pattern="^/mailraid/" negate="true" />
              </conditions>
              <action type="Rewrite" url="\mailraid\{R:0}" />
            </rule>
    
    
      
          </rules>
        </rewrite>
      </system.webServer>
    
    </configuration>

    Sunday, June 5, 2016 11:22 AM
  • If I do not misunderstand your question, you want to manage multiple domains directing to your one Azure Web App application. E.G. manage domain1.com and domain2.com to the same yourapp.azurewebsites.net.

    You can let your customer to add a CName of your azure application on his own DNS manage server.enter image description here

    Then, scale up your application's app service plan to at leaset share tier. And in CONFIGURE tab of your Azure Web App's portal page, under domain names section, add yor custom's domain into the list. E.G. enter image description here

    Any further concern, please feel free to let me know.

    Monday, June 6, 2016 5:21 AM
    Moderator