Canonical URL incorrect
-
Running v 14.0.4.
When posts are synced from my staging site to prod, the canonical URL (along with some other references) set by Yoast do not update correctly on the target Prod site. They show the URL of the source staging site instead.
The setting in Yoast is blank which should then use the actual page URL. This is a recent artifact. All other URLs and paths (not handled by Yoast) update correctly in the sync from staging to prod.
-
So what’s the remedy here? Go to the prod site and edit these properties directly to fix what Yoast is doing?
For any folks with similar issues… I installed WP Rollback and rolled Yoast back to version 13.5 as many have suggested. That corrected all of my posts that had munged up canonical URL references. YMMV.
Was the staging site running v 14.x and was the ‘speed up your site’ ran on the staging site before moving it to prod? I haven’t been able to reproduce the issue but since Yoast SEO 14.0 stores the canonical in the new database table. My guess is that something is out of sorts between the staging and prod for the new and old canonical fields in the database.
Does the wrong URL show in any other places? Sitemaps? Open Graph tags? Do you have any additional information that might help us reproduce the issue? The steps to push staging to prod vary so could you elaborate on how your process works? Are you using a staging plugin or a service by another company?
Both sites were running the same version of 14.x. I had never run ‘speed up your site’. The only place I saw incorrect URLs was in the canonical, an image path reference (for featured image I think) and the schema stuff that Yoast adds.
I don’t know anything about the internals of the sync from staging to prod. It’s on GoDaddy managed WordPress and uses their sync tool. It did not affect all posts on the site, only six out of seven of the most recent ones (possibly all edited since v14 was added but not sure about that).
I tried updating posts which showed the issue and re-syncing but the problem did not resolve.
As soon as I rolled back to 13.5 (on staging) and synced from staging to prod, all of the incorrect URLs corrected with no manual intervention.
We are unable to reproduce the issue as we do not have access to those tools described in the previous reply.
We would like some more information.
1. Are all your non-Yoast plugins and themes also updated?
2. Can you confirm you are using WordPress 5.4.1? You can check by clicking on the W in the top left and selecting About. If you need to update, please check with your host provider.?Please know that if you are using an older version of WordPress Core you may experience unexpected behavior with Yoast.?This guide explains more:?https://yoast.com/why-we-dont-support-old-wordpress-versions/.
If all were updated when you made the synch under v14.0.4 of Yoast we can only say that on the information you provided, we expect this to be a bug. We’re actively using the bug tracking on our GitHub repository so your best next step would be to create a new issue for our developers at https://github.com/Yoast/wordpress-seo/issues/new.
You will need an account to create a new issue. If this is your first bug report, please check out: https://kb.yoast.com/kb/how-to-write-a-good-bug-report/.
Note: That v14.1 of Yoast is expected sometime this week so you may wish to update to that version and see if the issue resolves. If it does not, please open up a bug report as described above.
Hi @ammdog ,
Thanks for your patience. We apologize for any issues caused on your site.
While we’re not familiar with the Godaddy sync tool, this is probably happening because the staging site URL is not being replaced in the production database.
There are two possible workarounds:
1) Do a search and replace in the database to completely replace any occurrences of the staging site domain with the production domain, especially in thewp_yoast-*
tables (your site might use a table prefix different fromwp
). There are plugins like “Better search and Replace” that can help you do this.2) On your production site, install the Yoast Test Helper plugin. Then, go to Tools -> Yoast Test and click on “Reset indexables”. Then, click the “Start processing and speed up your site now” button.
While the above procedures are safe, please make sure to have a complete backup of your site for safety reasons.
Can you please let us know if either of the above corrects the issue on your site?
We are going ahead and marking this issue as resolved due to inactivity. If you require any further assistance please create a new issue. Thank you!
I took your advice from above regarding Yoast Test Helper plugin and it seemed to solve my problem. Thanks!
I had the same problem. I developed a site on a temporary URL (eg using IP address) because the client had an existing website. When I swapped across and made the new site live I used Velvet Blue plugin to update all the references to the old temporary domain. But the canonical URL didn’t swap across to the domain name, it stayed as the old temporary URL.
I installed Yoast Test Helper and clicked on ‘Reset Indexables’ and it worked! Canonicals updated, including pages that use WooCommerce.Thanks for the plugin!
Test Helper did the trick! Thank you!!
A few of our users mention the same issue with wp staging. So we be added the solution into the docs: https://wp-staging.com/docs/yoast-canonical-urls-are-wrong-after-site-migration/
@pcosta88 is it viable for us to implement the yoast reset indexable function into wp staging to automatically reset yoast permalinks after migrating or is there a better and more recommended way to solve this programmatically? I don’t want to implement something that is going to be removed or uodated in yoast in the near future.
We already do a full search and replace with wp staging of old and new URLs when we migrate from staging to live so I wonder how the canonicals are stored and why the regular search and replace does not have any effect.
I did not check the source of the yoast reset function, yet.
This also messed up my site. Pretty sure I did not tell the plugin to optimize the database while still in staging.
Running the Yoast Test Helper and clicking on “Reset indexables tables & migration” fixed the issue.
I had the same problem a few days ago with this website https://www.mesbienfaits.com, and now it’s back to normal as you can see. The canonical URLs were wrong (staging URLs remaining). I was not aware of the solution with the Yoast Test Helper plugin, so I solved the problem by updating every single post, page and image one by one, just by clicking the “update” button. It was pretty long but it worked. So if you have a small website, this might be a solution for you too. However, if you have a large website, the Yoast Test Helper plugin appears to be a way better solution.
Will this problem be solved in the next updates? Anyway, thank you for your great work, and have a good day!
Same problem here – canonical urls and og urls point to the staging site url.
@amboutwe This thread sorted the issue for me, thanks guys. The Yoast Test Helper Plugin worked a treat, also good to know for other indexing issues too!
- This reply was modified 4 years, 1 month ago by Paul Jackson. Reason: Added Yoast link
- The topic ‘Canonical URL incorrect’ is closed to new replies.