Replace a wordpress site url in database with sed
Wordpress is one of the crappiest piece of software ever written. If you ever want to do simple stuff, like running different environments, you are already on your own. Read this page if you feel like crying. Wordpress doesn't provide anything for that and even if it would, some bad coded plugin will use hard coded urls anyway. It's just a huge mess. I didn't find anything to fix this, so I decided just to dump the whole database and replace the urls with the following sed commands:
sed -i -e 's/127\.0\.0\.1\/wordpress/production.example.com/g' database.sql sed -i -e 's/localhost\/wordpress/production.example.com/g' database.sql sed -i -e 's/localhost\\\/wordpress/production.example.com/g' database.sql sed -i -e 's/localhost\\\\\/wordpress/production.example.com/g' database.sql sed -i -e 's/localhost\%2Fwordpress/production.example.com/g' database.sql
With this you can replace
Seriously, how can people run large wordpress installations in production environments?