To move Matomo to a new domain or subdomain,

  • move all your Matomo files to the new directory, on your new domain or subdomain.
  • in your config/config.ini.php file, below [General] section, add a line with your new host: trusted_hosts[] = "example-stats.net"
  • delete the folder tmp/ within your new Matomo directory.
  • open the new Matomo URL in your browser, and check that Matomo works as expected.
  • update the tracking code to reflect the domain changes. Since the Matomo (Piwik) domain name has changed, you also need to change the Matomo JavaScript tags on all your tracked pages. For example, if Matomo was installed in matomo.example.org and is now installed in example-stats.net, you need to update the tags on all your websites’ pages to point to the new URL.
  • if you use the auto archiving cron, you may have to update or setup the script path in your crontab file.

If you want to reinstall Matomo please see How can I reinstall Matomo? Can I keep the existing data?

Previous FAQ: How do I migrate from Google Analytics to Matomo?