In case you are using some external system to get your products (like elasticsearch) you may need to reindex.
Also check if your test server does not link to the same external system as your main website.
I see that when I perform a search there is a call to
And that call returns an xml where the products link to
Not just search results, but all of the products in any product listing are linking with your staging server.
Check the list file
PathToYourTheme/catalog/product/list.phtml your anchor tags (
a) surely has hard coded links. Please use dynamic products links like
This should fix the issue