How do I stop Yoast plugin from saving <sitename>.azurewebsites.net URLs as canonical

massad 65 Reputation points
2023-10-23T01:47:17.01+00:00

The default <sitename>.azurewebsites.net domain is getting saved in the Yoast plugin somehow. This is the most popular Wordpress plugin for SEO. You can see it in their database tables. You can manually update it, but it could get overwritten because it's not clear how they got there in the first place.

When the site loads, this URL is added to the page markup as the canonical URL. So Google picks it up.

If you try to redirect this domain using nginx config, it breaks the Health Check and the CDN.

I have multiple custom domains set up on the App and also the CUSTOM_DOMAIN attribute set in the App Configuration. I set the CUSTOM_DOMAIN after I found this problem.

Question is - where is Yoast getting the <sitename>.azurewebsites.net domain from and how do we prevent that? Otherwise, eventually, every Wordpress site on App Service will have this URL showing up in Google because 99% of sites use this plugin.

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

1 answer

Sort by: Most helpful
  1. ajkuma 28,036 Reputation points Microsoft Employee Moderator
    2023-10-24T18:04:11.38+00:00

    Thanks for the follow-up and updating the question. Apologies for any issues that you may have encountered while submitting the question.

     

    If my understanding of your scenario description is correct, you are having an issue with the Yoast plugin and the default .azurewebsites.net domain being saved in its database tables.   Typically, you will update and configure the plugin in a similar way as you would host a WordPress site on-prem.

     

    Based on your requirement, you may consider to manually update the URLs in the Yoast plugin to your custom domain URLs. This could possibly prevent the default .azurewebsites.net domain from being added to the page markup as the canonical URL.  

    If you are looking to disable the default WebApp URL assigned to the Azure WebApp.

    You may add a 301 redirect rule on WordPress.

    Create Nginx redirect rule, as outlined in this discussion thread.

    Ref: Map an existing custom DNS name to Azure App Service 

    Kindly let us know with more info about the issue.


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.