Move WordPress server from Local to Live
Editing wordpress theme on localhost is very easy and fast, but its getting tricky if you want to move your site from local environment to live server.
Here is 4 step you need to follow:
- Move all file to live server.
- Move local database to live mySQL
- Change database details in wp-congig.php file
- Run the script bellow to change all localhost text with new site url.
UPDATE wp_options SET option_value = replace(option_value, 'localhost', 'www.newsite.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'localhost','www.newsite.com');
UPDATE wp_posts SET post_content = replace(post_content, 'localhost', 'www.newsite.com');