I recently moved a friends blog onto his new web hosts but unfortunately the images are not working.
This is due to the old host having the following path for images:
http://www.example.com/blog/wp-content/uploads/2009/07/imagename.jpg
The new host uses a different layout and has this 开发者_开发问答path for the file:
http://www.example.com/wp-content/uploads/2009/07/imagename.jpg
'Blog' has been removed.
Does anyone know the easiest way to fix this issue?
Use this query on your database:
UPDATE wp_posts SET guid = replace(guid, 'http://www.old-domain.com/blog','http://www.new-domain.com');
I've found this tutorial on Exporting and Importing Wordpress very helpful in such situations.
Search RegEx is a good plugin to be able to search and replace with Grep through all posts and pages. Also look in template files for hardcoded links in the form of <>php bloginfo(); ?>
for the unneeded /blog/ in the path.
Search replace is a good plugin as well as Search RegEx. Especially if your data to replace is widespread throughout your site. http://wordpress.org/extend/plugins/search-and-replace/
精彩评论