How to Redirect Multiple Domains to a Single Domain in Azure WordPress Service Plan?

Abel Moremi 0 Reputation points
2024-08-01T08:55:38.54+00:00

Hello everyone,

I've deployed an Azure WordPress Service Plan running on Linux, and everything is working well so far. I've attached three domains to the App Service Plan. However, I would like to redirect two of these domains to a primary domain.

Could someone please guide me on how to set up this domain redirection within the Azure WordPress Service Plan? Any specific configurations or steps would be greatly appreciated.

Thank you in advance for your help!

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

1 answer

Sort by: Most helpful
  1. ajkuma 28,036 Reputation points Microsoft Employee Moderator
    2024-08-05T18:56:36.3433333+00:00

    Abel Moremi, Apologies for the delayed response.

    Based on my understanding of your scenario, you may try the following approaches:

    Ensure all your custom domains are properly set up and verified in your Azure App Service.

    Configure URL Redirection in WordPress:

    1. Log in to your WordPress admin dashboard.
    2. Go to "Settings" > "General".
    3. Update the "Site Address (URL)" field to your primary domain.
      (This ensures that WordPress uses the primary domain for all URLs.)
    4. Save the changes.

    Just to highlight, Wordpress on Linux refers to the offering that is found here - Create a WordPress site --This uses an Alpine-based image with NGINX and PHP-FPM (currently PHP 8.x). NGINX is the web server used.

    On App Service either going to change nginx.conf or default.conf.

    1. Copy /etc/nginx/conf.d/default.conf to /home/dev. Our copy of the file will exist as /home/dev/default.conf
    2. Edit the existing startup fie in /home/dev/startup.sh to include the following:
    #!/bin/bash
    
    echo "Copying custom default.conf over to /etc/nginx/conf.d/default.conf"
    
    cp /home/dev/default.conf /etc/nginx/conf.d/default
    nginx -s reload
    

    3.Now, depending on what kind of redirect to be done, edit the default.conf with your intended change below.

    Kindly let us know, I'll follow-up with you further.


    Please accept as "Yes" if the answer provided is useful , so that you can help others in the community looking for remediation for similar issues.


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.