Zend certified PHP/Magento developer

SEO-URL Multistore problem, website-url is fine, but product-url stays the same

I have a multistore website, but the seo is not working totally fine
Like the title says: The website-url is fine, but product-url stays the same. But the product-url should be different for every store.
In the .phtml is the follwing code:

<?php foreach ($block->getUrls() as $url): ?>
    <link rel="alternate" href="<?php echo $url['href'] ?>" hrefLang="<?php echo $url['hrefLang'] ?>"/>
<?php endforeach; ?>

And in the .php the code is:

foreach ($this->getAllStore() as $store) {
        $arr[] = [
            'href'     => str_replace($this->getStoreBaseUrl(), $store->getBaseUrl(), $this->getCanonicalUrl()),
            'hrefLang' => $this->setHreflang($store->getId())
        ];

The wrong output is now:

<link rel="alternate" href="http://testing.xxx.de/victor-blue.html" hrefLang="de-DE"/>
<link rel="alternate" href="https://www.xxx.nl/victor-blue.html" hrefLang="x-default"/>
<link rel="alternate" href="https://testing.xxx.be/victor-blue.html" hrefLang="nl-BE"/>
<link rel="alternate" href="https://testing.xxx.fr/victor-blue.html" hrefLang="fr-FR"/>
<link rel="alternate" href="https://testing.xxx.com/victor-blue.html" hrefLang="en-GB"/>

But I want the correct url from the correct store (the color is different as below):

<link rel="alternate" href="http://testing.xxx.de/victor-blue.html" hrefLang="de-DE"/>
<link rel="alternate" href="https://www.xxx.nl/victor-blauw.html" hrefLang="x-default"/>
<link rel="alternate" href="https://testing.xxx.be/victor-turkoois.html" hrefLang="nl-BE"/>
<link rel="alternate" href="https://testing.xxx.fr/victor-blue.html" hrefLang="fr-FR"/>
<link rel="alternate" href="https://testing.xxx.com/victor-bluw.html" hrefLang="en-GB"/>

Who can help me?