0

I backed up my existing Wordpress site to work on it locally to create a multi-site network. My goal is not only to leave the existing site as-is, but add a new homepage with its own theme. I am trying to create a multi-site within a sub-folder.

I got it to work with a fresh install of Wordpress however I've run into complications with an existing local site.

Steps I've taken:

  • I changed the .htcaccess file to:

    # BEGIN Wordpress
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]
    # END WordPress
    
  • I've changed the ports from :8888 & :8889 to :80 & :3306

  • I've changed the host file within the terminal with the command:

    sudo nano /etc/hosts
     127.0.0.1         vslocal.com
     127.0.0.1         sub.vslocal.com
    
  • I performed a search and replace within the database with the new domain for the local site.

  • I changed the wp-config.php file to include:

    define('MULTISITE', true);
    define('SUBDOMAIN_INSTALL', false);
    define('DOMAIN_CURRENT_SITE', vslocal.com');   
    define('PATH_CURRENT_SITE', '/');
    define('SITE_ID_CURRENT_SITE', 1);  
    define('BLOG_ID_CURRENT_SITE', 1);
    

Now I am receiving the "Error establishing a database connection" error. After following different resources I might have confused myself and I'm having trouble with what steps have I missed or done incorrectly. I am running on a Mac OSX Yosemite and using MAMP 2.2. Any help will be a lifesaver! Thanks!

4

1 回答 1

0

除了配置语法错误之外,实际上我成功地从服务器到服务器的多站点迁移,以下是我采取的可以正常工作的步骤。

1.从服务器A迁移多站点文件并完成sql到服务器B(localhost);2.更改 db-config php 以启用新的数据库连接和你所做的域更改。3.在修改sqls之前,还是会看到“errorconnecting with db”。(但是如果你删除.htaccess或禁用它,db connection falure消息就会消失。所以这只是意味着多站点sql迁移不完全正确。 ) 搜索和替换 sql 字符串,确保 newurl 在所有站点的选项表、博客表和站点表等中替换 oldurl。

所以我想也许数据库连接失败错误与你的 sql 替换有关。

于 2014-11-05T08:49:20.510 回答