How to use Custom Domains with WordPress on App Service
Published Jul 28 2023 12:17 AM 4,795 Views
Microsoft

Try WordPress on Azure App Service!

Deploy to Azure

 

Once you set up a new WordPress website on App Service, you can access your website using the URL <app-name>.azurewebsites.net. Custom Domains are domain names that reflect your brand or company. For example, microsoft.com is the custom domain used by Microsoft for their website. In this article, we will learn about how we can use Custom Domains and subdomains with our WordPress website on App Service.

 

You can buy an App Service domain and use it with your WordPress website. App Service Domains are custom domains that are managed directly in Azure. Also, if you have an existing custom domain registered with any other registrar, you can use that with your WordPress website as well. We will also learn how we can add subdomains if we have a custom domain.

 

I. Buying an App Service Domain

 

Step 1: Go to the App Service page. You can see that the default domain is set to <app-name>.azurewebsites.net. You can use this URL to visit the website.

customwpsite.png

Step 2: In the left-hand pane, click on Custom Domains.

step1.png

 

Step 3: In the Custom Domains page, click on + Buy App Service domain if you want to buy an App Service domain or click on + Add custom domain if you have already purchased an App Service domain and you want to use it for this website.

step2.png

 

Step 4: Search for the domain name you want to use with your WordPress website. If the domain name is unavailable, you will also see a list recommended and available domain names. Once you finalize on the domain name, click on Next: Contact information >

step3.png

Step 5: Enter your contact details as required for domain name registration.

contact_page.png

 

Step 6: Once the order is verified in the Review + Create tab, click on Create.

reviewpluscreate.png

 

Step 7: You can see that the domain name is deployed. You can exit this Window.

step4.png

 

Step 8: Go to the App Service page > Custom domains. You will see that your new domain name is listed here. You can secure your domain names by clicking on Add binding. Then Click on Validate and Add.

nonbindingdomains.png

 

addbinding.png

bindingdomains.png

 

Step 9: [IMPORTANT] This step is very important if you are using Azure Front Door with your WordPress website or if you have a subdomain multisite set up. Go to Configuration Blade.

Add this Application Setting:

Name

Value

CUSTOM_DOMAIN

<your-custom-domain>

 

configuration_add.png

 

configuration_save.png

  

configuration.png

 

Step 10: Visit the website using your custom domain name.

wponappsrvsite.png

For more detailed information on the steps, advanced settings, and details of domain name registration, please read this article: Buy a custom domain - Azure App Service | Microsoft Learn

 

II. Mapping an existing domain from an external registrar

 

Step 1: In the Custom domains page, click on + Add custom domain

customdomainpage.png

Step 2: Select All other domain services as the Domain provider. Enter the existing domain name as the Domain. You will see two DNS records that you need to add in your domain’s DNS records. After adding, click on Validate.

addcustomdomain.png

 

Step 3: For demonstrating, I am using GoDaddy’s domain manager to add the DNS records.

godaddyDNS.png

 

addDNSrecords.png

Step 4: Once validated, you can now click on Add and the domain will be added to the list.

ValidatednowAdd.png

 

Step 5: We can add binding to the domain to make it secure.

no binding.png

addbinding.png

 

all domains.png

For more advanced options, refer to Map existing custom DNS name - Azure App Service | Microsoft Learn

 

III. Adding a subdomain to a custom domain

 

We can also add subdomains to our App Service. A subdomain can be used for subdomain multisite.

 

Step 1: In the Custom Domains page, click on + Add custom domain

customdomainpage.png

 

Step 2: Select the App Service domain you need and select Subdomain as the Domain type. Enter the subdomain name and click Add.

addsubdomain.png

 

Step 3: Now you can see that the subdomain has been added.

allsiteslisted.png

 

Note: In this example you will not be able to access your WordPress website using the new domain name wordpressonappservice.xyz , or the subdomain site1.wordpressonappservice.com, or even using the default domain customwp.azurewebsites.net, because the WordPress website is configured with the custom domain: wordpressonappservice.com. If you wish to use any of the other available domain names, you can edit the wp-config.php file and add the desired URL to these lines:

 

define('WP_HOME', ' <URL>');
define('WP_SITEURL', '<URL>');

 

This new domain and the subdomain can also be used to map to sites within your multisite network. Refer to [Subdomain multisite link]

 

Support and Feedback

 

In case you need any support, you can open a support request at New support request - Microsoft Azure.

 

For more details about the offering, please visit Announcing the General Availability of WordPress on Azure App Service - Microsoft Tech Community.

 

If you have any ideas about how we can make WordPress on Azure App Service better, please post your ideas at Post idea · Community (azure.com)

 

or report an issue at Issues · Azure/wordpress-linux-appservice (github.com)

 

or you could email us at wordpressonazure@microsoft.com to start a conversation. 

1 Comment
Co-Authors
Version history
Last update:
‎Jul 28 2023 12:17 AM
Updated by: