custom domain redirect to default urls on Azure WordPress site

Saram 0 Reputation points


My Azure WordPress site domain redirects to my default urls. DNS is all set up and secure. Wordpress general setting is also set on Custom domain. The site did accessed through custom domain But all pages URLs are on default This link also has the same issue but I can't find any working solution here.

Site wp-config.php file has this code

//Relative URLs for swapping across app service deployment slots
define('WP_HOME', $http_protocol . $_SERVER['HTTP_HOST']);
define('WP_SITEURL', $http_protocol . $_SERVER['HTTP_HOST']);
define('WP_CONTENT_URL', '/wp-content');

How can I edit it to point to my Custom domain URL. I have no experience with linux or how to use this solution.

Also, site can be accessed through a custom domain and DNS is on Azure IP But when you try to reach it through IP address it gives a 404 error. Site is using Cloudflare nameserver, If that is the reason for this problem.

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,283 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,036 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. ajkuma 22,851 Reputation points Microsoft Employee

    @Saram , Apologies for the delay from over the weekend. I understand that have tried multiple steps to isolate this issue.

    Firstly, just to highlight App Service support HTTPS on * domain name and the certificate is provided and owned by Azure.

    By default, works even with custom domain added, and the site admins aware about the URL can access, but typically end users would not access this URL directly (unless explicitly shared).

    Typically, the redirection can occur for two reasons:

    1. URL settings on the database. There are two fields named SITEURL and HOME within the wp_options table that control the URL redirects.
    2. Defined constants in wp-config.php

    On App Service: The wp-config.php files can be updated using either Kudu console or FTP Client (such as FileZilla). Try the steps (double-check) as outlined (A-D) in this article.

    1. Browse to Kudu : http://”yoursitename”

    Example: if your Azure App Service Web App name is “testwebapp”, then surf to

    1. Click ‘Debug Console’ and select ‘CMD’

    Traverse to wwwroot folder

    1. For WordPress, update wp-config.php

    -make necessary changes, and save.

    Additionally, you may try adding a robot.txt file for google indexing the site as mentioned by Peter on SO discussion thread.

     If the answer helped (pointed, you in the right direction) > please click Accept Answer - it will help users to find the answers quickly.

    0 comments No comments