Hello,
I am trying to change the domain name in the metatags autogenerated by Yoast SEO. The issue is I have two separate domains i.e one is the main domain eg: www.abc.com and another domain eg: www.prod.abc.com, used as a reverse proxy. The actual content is in the backend domain. The home and siteurl are configured dynamically, the links are autogenerated in the backend with domain name www.prod.abc.com. I want to change it to the main domain name i.e. www.abc.com.
Here is an example of how I can change the canonical links,
“`
add_filter( ‘wpseo_canonical’, function( $canonical ) {
if( ‘https://www.abc.com’ == get_option( ‘home’ ) ) {
return $canonical;
}
$canonical = preg_replace(‘#//[^/]*/#U’, ‘//www.abc.com/’, trailingslashit( $canonical ) );
return $canonical;
});
“`
I want to change all links to www.abc.com
[ad_2]