Change domain of a wordpress website

What I find a major hassle when dealing with wordpress websites is to transfer the website from a development environment to a production environment. The domain you use in a development stage will be different from the one of the production website. Therefore you have to alter all the urls within the posts, the links of the posts and the site_url.

I just use a sql to find and replace all these urls:

update wp_options set option_value = replace(option_value, 'http://localhost/wordpress', '');
update wp_posts set guid = replace(guid, 'http://localhost/wordpress', '');
update wp_posts set post_content = replace(post_content, 'http://localhost/wordpress', '');

 The “http://localhost/wordpress” is the url I want to replace in the database to the production url “”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s