Archive

Posts Tagged ‘Go live’

Wordpress Notes — Going live from local development environment

March 17th, 2009

As I launch more wordpress web sites, I am realizing that there are inherent issues with how Wordpress saves the posts…it always uses absolute path for URL links.  This creates problem for me as in my scenario, all of my local development have a url path of http://localhost:8080/sitename, so when I moved the blog to production and assign it a valid domain name like http://blog.52my.info, all the existing post links and image links would still be referring to the local computer for images and posts! This is TRICKY, as you won’t noticed this problem, because more than likely YOU ARE browsing the site that you have uploaded using the same computer where the dev blog was hosted, and you would see all images load up properly b/c they are stored on your local computer.  But when you go to another computer, you will see all the missing posts and images, etc.

The fix for this is to run several SQL scripts in which it would do a find and replace for all data in the mysql tables and rename them to the proper domain name url. I found this information from this great post here. But the long and short of it is run the following scrips:

1. update the wp_options table:

UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-domain.com', 'http://www.new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';

2. Update wp_posts

UPDATE wp_posts SET guid = replace(guid, 'http://www.old-domain.com','http://www.new-domain.com');

3. Update post contents in which there are links within post content to the blog itself:

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-domain.com', 'http://www.new-domain.com');

blog posting, technical notes, wordpress , ,