database - Redirecting to old domain after migration website

admin2025-01-07  3

Could someone help me with restoring my website (with new domain name)? I have a database backup and when restore it, wordpress is redirecting me to old website and domain. I changed site url in mysql and now I have this message: This nataura.ro page can’t be foundNo webpage was found for the web address: / HTTP ERROR 404

Could someone help me with restoring my website (with new domain name)? I have a database backup and when restore it, wordpress is redirecting me to old website and domain. I changed site url in mysql and now I have this message: This nataura.ro page can’t be foundNo webpage was found for the web address: https://nataura.ro/wordpress/ HTTP ERROR 404

Share Improve this question asked Jun 18, 2020 at 7:25 Dejana PopovicDejana Popovic 111 silver badge2 bronze badges 1
  • Use a database migration plugin, and double-check that the URL is not set in your wp-config.php file. The site URL is only one of many places that need the new domain, and many of them are serialized, which is why using a plugin to update them all is safer than trying a search-and-replace directly in the database. – WebElaine Commented Jun 18, 2020 at 14:53
Add a comment  | 

2 Answers 2

Reset to default 0

First of all, make sure you're domain has correct nameserver setup and you're uploading files to correct place. When you are changing URL from database directly, here's a checklist.

  1. The URL must be changed only from wp_options table and update only siteurl & home (basically first 2) rows.
  2. Make sure you're setting http/https correctly. set https only if you have SSL enabled in the new domain.
  3. Use a plugin like Better Search & Replace to replace domain and update permalinks and other urls.

If it's still pointing to old URL,

  1. Check .htaccess file if there is old domain. If so, replace that. Also be careful about http/https.
  2. Disable any possible plugin that can redirect home page. Just rename the plugin's folder to disable that.
  3. If still doesn't work, try to disable the theme same way.
  4. As last resort replace all core files with fresh downloaded zip file then check wp-config.php file to set correct credentials.

There are several ways to update the site URL after migrating:

Using WP-CLI

Run this command:

wp search-replace "https://olddomain.com" "https://newdomain.com"

Use the search and replace DB script

  • Download it from Github
  • Unzip and upload to your host
  • Run the script and follow the instructions

Manual update the DB and fix the DB

  • Go to phpMyAdmin and find the option siteurl and home, change them to the new website URL
  • Go to the new website's admin area and install the plugin "Better Search & Replace"
  • Use the plugin to update the old domain to the new domain in your database.

It's important to keep the folder structure of the new website the same as the old website, especially when you put WordPress in a sub-folder.

And make sure you remove all the cache and maybe CloudFlare cache (if you use it). Then try again with a clean browser history.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736262660a830.html

最新回复(0)