WordPress – Use SED to find replace you hostname

First dump your database

mysqldump -uroot -p wordpress > wordpress.sql

Then use SED to find/replace the host string

sed 's,'https://old-hostname.com','https://new-hostname.com',g' -i /wordpress.sql

sed 's,'http://old-hostname.com','https://new-hostname.com',g' -i /wordpress.sql

sed 's,'old-hostname.com','new-hostname.com',g' -i /wordpress.sql

 

Gareth
Buy Me A Coffee
back arrowBack to Index