0

In my Ubuntu VPS, to search and replace in a DB of a site I do for example:

cd /var/www/html/example.com
sudo wp search-replace "http://" "https://" --all-tables

Yet in Windows 10 I use XAMPP and can't do this action with WSL + WP-CLI because one cannot use Bash inside windows (yet).

My problem

I have installed a backup version of an online website in Windows XAMPP and all main menu links turn to the online site so I need to change in DB from https:// to localhost://.

My question

How could I easily and efficiently change the DB from https:// to localhost://. in XAMPP in Windows?

2 Answers 2

0

you have the new database selected, then run some sql updates and replacement commands on the tables notably, wp_options, wp_posts, wp_postmeta.

UPDATE wp_options SET option_value = replace(option_value, 'https://livesite.com', 'http://localhost/sitename') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET guid = replace(guid, 'https://livesite.com','http://localhost/sitename');

UPDATE wp_posts SET post_content = replace(post_content, 'https://livesite.com', 'http://localhost/sitename');

UPDATE wp_postmeta SET meta_value = replace(meta_value, 'https://livesite.com', 'http://localhost/sitename');
0

I like to use the Search Replace DB available here - https://interconnectit.com/products/search-and-replace-for-wordpress-databases/

It has a great UI and also you can perform a "dry run" to see which tables will get affected before actually making any changes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.