site url is not working after migration in wordpress, all links are broken

Solution:1

Please Replace old url to new url in your database

  1. UPDATE wp_options SET option_value = replace(option_value, ‘http://olddomain.com‘, ‘http://newdomain.com‘) WHERE option_name = ‘home’ OR option_name = ‘siteurl’;
  2. UPDATE wp_posts SET guid = replace(guid, ‘http://olddomain.com‘,’http://newdomain.com‘);
  3. UPDATE wp_posts SET post_content = replace(post_content, ‘http://olddomain.com‘, ‘http://newdomain.com‘);
  4. UPDATE wp_postmeta SET meta_value = replace(meta_value, ‘http://olddomain.com‘, ‘http://newdomain.com‘);

Solution:2

Please take a back up of files and database then after open you mysql in code editor, then do search and replace from old links to the new links. Save it and upload the updated sql file to your new database.Now go to backend and save the permalinks.