Hello @ikickrobots
Thanks for using the Yoast SEO plugin. I assume what you described is your setup using reverse proxy. Please note that the Yoast SEO plugin uses the home_URL or site address defined in WordPress > Settings > General or in the wp-config file to fetch URLs. You might get errors, unexpected behavior or incorrect information in REST API if your setup uses the site_URL or WordPress address.
Hello,
Right I am using the reverse proxy. The admin page is not accessible from the main domain hence I have to work on backend host. I tried using yoast helper, reset the wp_yoast_indexable table however if I run optimization from backend host then all the URLs will be indexed with the backend host. To tackle this I can reset the table again and run wp yoast index command from GUI which gives the right home_url. The issue is if someone browse the site using the backend host, the backend URL will again index in the table. This is something unexpected. Is there a way to override the home_url just for yoast seo plugin? This should solve the issue I am currently having.
The only solution is to ensure you have the same home_URL and site_URL address. I understand this may be impossible in your case but it’s the way
I can’t set only one home_URL in my case. It changes dynamically and is set in the wp-config.php file.
Is it possible to set a fixed home_URL name for yoast seo plugin only? Maybe something like https://github.com/Yoast/wordpress-seo/blob/e5ceece5469ca38c1b8bb2d35bf5567210b83c92/src/helpers/url-helper.php#L79 can be used to override the home_url.
Further, is it possible not to index the pages if browsed through GUI? It can help in my case as using wpcli I can still index the page using cronjob and it will always give the right home_url i.e main domain.
Is it possible to set a fixed home_URL name for yoast seo plugin only?
You could give it a try
is it possible not to index the pages if browsed through GUI?
It’s possible to prevent Yoast SEO from adding specific post types to indexables table using this filter
Do you have any example of using wpseo_home_url ? I expect yoast seo not to update canonical urls and other links with backend urls.
-
This reply was modified 2 years, 10 months ago by
ikickrobots.
I tried using wpseo_home_url action but wp_yoast_indexable still updating the backend host urls. Any suggestions to solve this issue?
No, I don’t have an example. And though I can’t help any further, someone from the community might help you when visiting this thread. So, I’ll leave the thread open for a couple of days.
No problem, I have found an example here https://github.com/Yoast/wordpress-seo/issues/16723, which I tried but didn’t work as expected. I hope to see some features in the future.
thank you.
I disabled the Yoast indexing using the following for the backend domains
add_filter( 'Yoast\WP\SEO\should_index_indexables', '__return_false' );
When I browse the site from the backend host, the URLs are not being updated in wp_yoast_indexable table and all the metatags were looking good too. However, when I checked the metatags and wp_yoast_indexable table today, I see backend URLs in the permalink. 🙁
I wish to have an option to set the main domain in the plugin itself. This is really frustrating.