Background of the issue:
I have a site in two languages (SI, HR) with the second language being on a different domain. The original domain is hidden link and the HR domain is hidden link. I am trying to fix a sitemap issue.
Symptoms:
The sitemap is showing 404 errors because it links to hidden link instead of hidden link.
Questions:
How can I fix the sitemap links to point to the correct domain for the HR language?
Reference to our recent chat, I've moved to this ticket for further investigation. As mentioned, I'll be off over the weekend and 'll be able to attend on Monday and 'll keep you posted about the progress.
I reproduced the issue in local with minimal setup, however, in another fresh sandbox issue does not happen. So I've escalated this to our 2nd tier team for further investigation, along the package of your site.
Our team has investigated the issue in detail and found that issue isn't related to WPML or WPML SEO, but is coming from Rank Math SEO, as they put it:
Without WPML there are 131 Posts. The posts sitemap only shows 88 Posts.
Without WPML there are a total of 39 Pages. The pages sitemap shows only 8 Pages.
The sitemaps should work without WPML for them to be expected to work with WPML.
It is requested to check with Rank Math support please, so they can provide you a solution. Once it works without Rank Math, then check with WPML and WPML SEO and if issue arises due to WPML, please feel free to report again.