How can i modify Wordpress (WordPress Address (URL) and Site Address (URL)) in app service using azure frontdoor with custom domain.

David Alejandro Rodriguez Toro 20 Reputation points
2025-03-03T17:30:46.3433333+00:00

I am trying to configure or expose via Frontdoor a wordpress hosted on Azure App Service. I have a problem and is that the wordpress was modified underneath (plugins were installed, images were uploaded etc), and when I try to make the configuration within the app service (setting the environment variables AFD_ENDPOINT and AFD_ENABLED), it does not change the values within the wordpress Site Address (URL) and WordPress Address (URL).

I followed the documentation in the following link: https://github.com/Azure/wordpress-linux-appservice/blob/main/WordPress/wordpress_afd_configuration.md, but it does not change the value, and this generates problems when consumed through the frontdoor because any redirect the wordpress itself redirects the domain to the default (.azurewebsites.net).

I did the same test with a new wordpress, in the initial configuration I did the test configuring AFD and without configuring it (configuring it manually later) and in both cases it worked, the problem I have is specifically with a site already configured with plugins (which currently has domain .azurewebsites.net) does not change that value inside the wordpress.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,933 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Alekhya Vaddepally 1,670 Reputation points Microsoft External Staff Moderator
    2025-03-04T11:41:51.7166667+00:00

    Hi David R,

    It seems like When integrating Azure Front Door with your WordPress site hosted on Azure App Service, it's essential that WordPress recognizes and utilizes the AFD endpoint as its primary URL.

    That includes all internal links, redirects, and resources are correctly referenced through the AFD's custom domain, rather than the default *.azurewebsites.net domain.

    The environment variables AFD_ENDPOINT and AFD_ENABLED are intended to facilitate this configuration, by updating the WP_HOME and WP_SITEURL constants in the wp-config.php file.

    If the environment variables aren't reflecting the desired changes, you can manually set the WP_HOME and WP_SITEURL constants in your wp-config.php file to match your AFD custom domain.

    Use an FTP client or Azure's Kudu console to navigate to your site's root directory and open the wp-config.php file, in that

    replacing https://your-custom-domain.com with your actual AFD custom domain (WP_HOME and WP_SITEURL).

    define('WP_HOME', 'https://your-custom-domain.com');

    define('WP_SITEURL', 'https://your-custom-domain.com');

    This manual configuration ensures that WordPress generates URLs and handles redirects using your custom domain.

    To assure all traffic flows through Azure Front Door, configure access restrictions on your Azure App Service to accept requests only from Azure Front Door.

    This enhances security and ensures consistent URL handling.

    https://learn.microsoft.com/en-us/azure/frontdoor/origin-security?tabs=app-service-functions&pivots=front-door-standard-premium

    If the answer is helpful, please click Accept Answer and kindly upvote it so that other people who faces similar issue may get benefitted from it.

    Let me know if you have any further Queries.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.