Sometimes I need to create a WordPress website clone for testing purposes. This normally goes onto a subdomain, i.e. if the main website is mysite.com, the temporary test version will be dev.mysite.com. If you simply restore the website, including the SQL database from a backup, as soon as you try to navigate to dev.mysite.com, you will be redirected to mysite.com.

To resolve the issue, you need to make a few small changes:

  • In the website's hosting root directory (normally httpdocs) open wp-config.php and update the database name, user, and password.
  • Open the SQL database table xxxx_option in phpMyAdmin, and update siteurl and home value to point to the new domain (i.e. https://dev.mysite.com).
  • This is not required for the new website to work, but if the dev site is public, you probably don't want search engined to index it. To prevent this, login to the WordPress wp-admin, go to Settings > Reading and enable “Discourage search engines from indexing this site" option.

November 2023
WordPress
phpMyAdmin

 

No comments

Leave your comment

In reply to Some User
Captcha Image