迁移WordPress多站点

时间:2018-06-20 07:38:46

标签: php wordpress multisite

我们的客户已有使用WordPress多站点构建的网站,我正在尝试在本地环境中获取副本设置。

因此,我从产品中获取数据库。现在我已成功将其导入本地。

  1. 首先,我编辑wp_options site_url和家庭名称。
  2. 然后我用数据库配置编辑wp-config.php。
  3. 最后,我在多站点配置中编辑URL

    define('WP_ALLOW_MULTISITE',true); define('MULTISITE',true); define('SUBDOMAIN_INSTALL',false); define('DOMAIN_CURRENT_SITE','mylocal-copy.test'); define('PATH_CURRENT_SITE','/'); define('SITE_ID_CURRENT_SITE',1); define('BLOG_ID_CURRENT_SITE',1);

无论如何,每次我访问mylocal-copy.test都会返回。

Error establishing a database connection

我很确定数据库已经设置好并且可以运行。

现在,我进入数据库并找到wp_blog表,我将第一行域列编辑到我的本地env域中,并且它可以正常工作,但是当我单击以访问仪表板上的站点时,那些其他网站会重定向到产品或生活中服务器。

enter image description here

我的问题是我是否需要编辑wp_blog表的所有行才能在本地运行此多站点?还是我错过了wp-config.php上的东西?

我的wp-config.php

<?php
/**
 * The base configuration for WordPress
 *
 * The wp-config.php creation script uses this file during the
 * installation. You don't have to use the web site, you can
 * copy this file to "wp-config.php" and fill in the values.
 *
 * This file contains the following configurations:
 *
 * * MySQL settings
 * * Secret keys
 * * Database table prefix
 * * ABSPATH
 *
 * @link https://codex.wordpress.org/Editing_wp-config.php
 *
 * @package WordPress
 */

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'database_working');

/** MySQL database username */
define('DB_USER', 'secret');

/** MySQL database password */
define('DB_PASSWORD', 'secret');

/** MySQL hostname */
define('DB_HOST', 'localhost ');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8mb4');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

/**#@+
 * Authentication Unique Keys and Salts.
 *
 * Change these to different unique phrases!
 * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
 * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
 *
 * @since 2.6.0
 */
define('AUTH_KEY',         'Y;PfM~+cT(^ibz@3bG-e~(x<Ab4ID@cQVMC^sqO;#N1u8]wT{zWJJQ)Hv1d49p+X');
define('SECURE_AUTH_KEY',  '%=co|p5it*f_;,TdT:#DO4%aVx,]Kv@:{*W/NtsVS)OywSY:$R]{eX0a7#k<w{~v');
define('LOGGED_IN_KEY',    'Vc`4&udHwGw9D(}H=.X7rPJ$5{I@Ie;T`o :NuMn_RuYXmWjuD=?GF?^l$<2_aGR');
define('NONCE_KEY',        '._fl/[2qmaD$xW+)!na-2qQbsAa*AB$6B={UYiAR,A|%61*U%C!e:fTICtKPvxl;');
define('AUTH_SALT',        '5}|v/i}*:ugwG|Sh]U#Hf/?Q23/ZO1v<h6W>7pDx4{5},6&W+NZ)|<&yI$FU2ANR');
define('SECURE_AUTH_SALT', 'N@+W-NKI]vHdtZ[i=UV2b01tuL!,U&YZ}xH0+V8Tq~xv&;Y<Cxk,!`j1W]pf?hXS');
define('LOGGED_IN_SALT',   'cQ3AoO*a}0U/f%[MqH^U%;83-<.!B )B*OLyP<.*fg2w k39zQC3H#<r5V7h,nzF');
define('NONCE_SALT',       '<b4$^SZ)8r1}F>*1aDYyJ6X$sF=F=H*dLfsrMvQ+cLfpKB6]GL&i0m8P6ab[a`TZ');

/**#@-*/

/**
 * WordPress Database Table prefix.
 *
 * You can have multiple installations in one database if you give each
 * a unique prefix. Only numbers, letters, and underscores please!
 */
$table_prefix  = 'wp_';

/****************************************************************************/
/*                         Multisite Configuration                          */
/****************************************************************************/
define( 'WP_ALLOW_MULTISITE', true );
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'mylocal-copy.test');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

/****************************************************************************/
/*                        General WordPress Settings                        */
/****************************************************************************/
define('WPLANG', '');
define('WP_DEBUG', true);
define('WP_CACHE', false);
define('WP_DEBUG_LOG', false);


/* That's all, stop editing! Happy blogging. */

/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
    define('ABSPATH', dirname(__FILE__) . '/');

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');

谢谢!

0 个答案:

没有答案