Matomo answering multiples URLs

I have a old and new instance of Matomo.
webanalytics.mycompany.com and wa.mycompany.com (wa = web analytics)

I want transfer all traffic from webanalytics server to wa server changing the DNS of first, setting it to wa.

The second instance (wa) will receive this traffic? In wa, all site’s id are the same in webanalytics site.

Not easy to understand your steps…
If Matomo server changes its domain name, you’ll have to change the calls to Matomo scripts…
And if you use MTM, don’t forget to update also the Matomo Configuration variable.

Thank you by your reply, @heurteph-ei

I not know what is MTM.

Anyway, I found in Settings > General > Trust Hostname a space for multiples canonical names. I imagine that is only add ‘webanalytics.mycompany.com’ name in next entry after ‘wa.mycompany.com’ and my new matomo instance will read also the first domain name.

After, is to change the DNS for webanalytics to IP of wa and finish.

What do you think?

Don’t forget to update the Matomo bootstrap in the tracked pages, as the Matomo server address is provided:

<!-- Matomo -->
<script type="text/javascript">
  var _paq = window._paq = window._paq || [];
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="//{$MATOMO_URL}/"; // HERE!!!
    _paq.push(['setTrackerUrl', u+'matomo.php']);
    _paq.push(['setSiteId', {$IDSITE}]);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
  })();
</script>
<!-- End Matomo Code -->

PS: MTM is Matomo Tag Manager:
https://matomo.org/docs/tag-manager/

If this feature works (Trusted Hostname), is only ‘turn the key’ in DNS from old IP to new IP (i think), that new instance will get all traffic. Or not? :thinking:

If your browser sends traffic to an address name that doesn’t exist anymore, nothing will arrive to your server!
Then if you just change the name in DNS from webanalytics.mycompany.com to wa.mycompany.com, your old scripts that hit webanalytics.mycompany.com will encounter unknown domain name error

Sorry by my mistake. I believe that I not explaned correctly.

Today I have 2 environment, each one with its address name: webanalytics and wa. Both are running.

How I reforced the WA env, I wait to bring all sites that are running in webanalytics site to WA site. How I want NOT change the script in my systems (at this moment), I think in to change the DNS for webanalytics pointing to WA site.

All Ids sites already are registered in WA equal to webanalytics. So, all clients will connect to WA site equal to webanalytics.

If DNS table is updated, it should be OK, I think (both wa and webanalytics registered to the same IP)