Staging environment redirects to live site, each time we take a pull

We are facing following issue, whenever we create staging environment, it appears, it doesn’t update / replace all the url’s in the database as in the end, once pull / synch is complete, the
staging environment keeps pointing back to main/live site. Which is obviously be problematic.

One way to resolve is to find and replace all the instances of the main site domain name in the staging database, this has two problems

  • there is not friendly utility to do so, at present it has to be done manually one by one for each found match, which can be quite time consuming
  • even if the above step was done and the staging starts working properly, then somewhere down the line when we synch staging again from the live, the problem resurfaces.

Following is the link where people have tried out various ways to patch the problem on a clone, but obviously it is not dealt with in its entirety hence should be taken care by
the cloudways dev / support team.

Yes this is a challenge. I have a Wordpress Multisite and it is even more complex.

Thanks for the link on your post. It didn’t help me but was interesting!