简体   繁体   English

备份/还原 wordpress 站点(更改域)

[英]Backup / Restore wordpress site (change domain)

I have developed a wordpress based website on localhost.我在本地主机上开发了一个基于 wordpress 的网站。 I wanted to migrate that on to www.mydomain.com.我想将其迁移到 www.mydomain.com。 I checked in all the files from /var/www/wordpress from my localhost to a svn repository.我将 /var/www/wordpress 中的所有文件从本地主机签入到 svn 存储库。 And at the www.mydomain.com, I did a svn checkout.在 www.mydomain.com,我进行了 svn 结帐。 I also exported the wordpress database and imported it to my new domain.我还导出了 wordpress 数据库并将其导入到我的新域中。

I am using Graphene theme.我正在使用石墨烯主题。

I modified all localhost in wp_options table to my domain name.我将 wp_options 表中的所有 localhost 都修改为我的域名。 Got it working, but noticed a few things missing.让它工作,但发现缺少一些东西。

  • Mapping of my 3 menus, main, secondary and footer映射我的 3 个菜单,主菜单、辅助菜单和页脚
  • A post that I added for my side bar plugin at my localhost, is missing on my new domain我在本地主机上为侧边栏插件添加的帖子在我的新域中丢失了
  • Background color setting from Appearance->Background外观->背景中的背景颜色设置

Am I missing something?我错过了什么吗? A folder or something else?文件夹还是别的?

Edit: Also just read http://lorelle.wordpress.com/2005/12/01/search-and-replace-in-wordpress-mysql-database/编辑:也只是阅读http://lorelle.wordpress.com/2005/12/01/search-and-replace-in-wordpress-mysql-database/

I modified all localhost in wp_options table to my domain name我将 wp_options 表中的所有 localhost 都修改为我的域名

How did you do that?你是怎么做到的? In a text editor with the database dump?在带有数据库转储的文本编辑器中? That will break some data in the database.这将破坏数据库中的一些数据。

It's best to use queries in phpmyadmin to change URLs in the database.最好使用 phpmyadmin 中的查询来更改数据库中的 URL。 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/');

Use phpmyadmin at your webhost or use it as a plugin;在您的虚拟主机上使用 phpmyadmin 或将其用作插件; see WordPress › Portable phpMyAdmin « WordPress Plugins.请参阅WordPress › 便携式 phpMyAdmin « WordPress 插件。

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.但最好使用interconnectit.com WordPress 序列化 PHP 搜索替换工具正确反序列化/重新序列化数据库中的数据,因为使用上面的普通查询可能会破坏序列化数据。

And see Moving WordPress « WordPress Codex.并参见移动 WordPress « WordPress 法典。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM