URL problem in my site

Use the duplicator plugin. It basically make a snapshot and an Installer.php file. When moving the archive snapshot zip and php file to your new server, you navigate to http://yoursite.com/Installer.php. It’s like a setup process that asks you for your new database (you can point it to an empty database) and what the new URL should be. It will update your URL all across the site to the new URL.

Once I found this plugin I have never used anything else.

Plugin link: https://wordpress.org/plugins/duplicator/