备份/恢复 wordpress 站点(更改域) [英] Backup / Restore wordpress site (change domain)
问题描述
我在本地主机上开发了一个基于 wordpress 的网站.我想将其迁移到 www.mydomain.com.我将/var/www/wordpress 中的所有文件从我的本地主机检入到 svn 存储库.在 www.mydomain.com,我做了一个 svn checkout.我还导出了 wordpress 数据库并将其导入到我的新域中.
I have developed a wordpress based website on localhost. I wanted to migrate that on to www.mydomain.com. I checked in all the files from /var/www/wordpress from my localhost to a svn repository. And at the www.mydomain.com, I did a svn checkout. I also exported the wordpress database and imported it to my new domain.
我正在使用石墨烯主题.
I am using Graphene theme.
我将 wp_options 表中的所有 localhost 都修改为我的域名.运行正常,但发现缺少一些东西.
I modified all localhost in wp_options table to my domain name. Got it working, but noticed a few things missing.
- 映射我的 3 个菜单,主菜单、辅助菜单和页脚
- 我在本地主机上为侧边栏插件添加的帖子在我的新域中丢失
- 从外观->背景设置背景色
我错过了什么吗?文件夹还是其他东西?
Am I missing something ? A folder or something else ?
也只是阅读http://lorelle.wordpress.com/2005/12/01/search-and-replace-in-wordpress-mysql-database/
推荐答案
我将 wp_options 表中的所有 localhost 都修改为我的域名
I modified all localhost in wp_options table to my domain name
你是怎么做到的?在带有数据库转储的文本编辑器中?这会破坏数据库中的一些数据.
How did you do that? In a text editor with the database dump? That will break some data in the database.
最好使用 phpmyadmin 中的查询来更改数据库中的 URL.使用:
It's best to use queries in phpmyadmin to change URLs in the database. Use:
UPDATE wp_options SET option_value = replace(option_value, 'http://www.olddomain.com/', 'http://www.newdomain.com/') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.olddomain.com/','http://www.newdomain.com/');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.olddomain.com/', 'http://www.newdomain.com/');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://www.olddomain.com/', 'http://www.newdomain.com/');
在您的虚拟主机上使用 phpmyadmin 或将其用作插件;请参阅 WordPress › 便携式 phpMyAdmin « WordPress 插件.
Use phpmyadmin at your webhost or use it as a plugin; see WordPress › Portable phpMyAdmin « WordPress Plugins.
但最好使用 interconnectit.com WordPress 序列化 PHP 搜索替换工具,可正确反序列化/重新序列化数据库中的数据,因为使用上述纯查询可能会破坏序列化数据.
But it's even better to use interconnectit.com WordPress Serialized PHP Search Replace Tool that correctly deserializes/reserialize data in the database, as using the plain queries above can break serialized data.
并参见 Moving WordPress « WordPress Codex.
这篇关于备份/恢复 wordpress 站点(更改域)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!