If we want to migrate a wordpress website from localhost or from development server to actual new domain then we need to change wordpress siteurl and homeurl.
To change the siteurl and home url in WordPress using SQL commands, you can follow these steps:
- Access your WordPress database through phpMyAdmin or any other database management tool.
- Locate the
wp_options
table and click on it to open it. - Find the
siteurl
andhome
rows in the table and click on the "Edit" button next to each row. - Change the value in the "option_value" column to your new URL and click the "Go" button to save your changes.
- Once you have updated both rows, clear your browser cache and refresh your WordPress site to see the changes take effect.
Here is an example of the MySQL commands to update the siteurl and home values in the wp_options table:
UPDATE wp_options SET option_value = 'https://www.codentricks.com' WHERE option_name = 'siteurl';
UPDATE wp_options SET option_value = 'https://www.codentricks.com' WHERE option_name = 'home';
Note that you should replace
https://www.codentricks.com
with your actual new URL. It is also important to make a backup of your database before making any changes.