首先,我read a number 此流程上的帖子数。然而,由于各种原因,该过程仍然很难实现或排除故障,因为甚至缺乏抽象的示例,或者可能过于抽象。还有一些“做不到”的帖子,后面几乎总是跟着“with 3.5,you now can”的警告,所以一个人是否可以仍然模棱两可,尽管毫无疑问这很重要。
总结:如何从根目录移动wordpress多站点(WPMS)。com到根目录/博客?
在本例中,我们将WPMS从“root.com”移动到“root.com/blogs”
我知道我需要更新数据库和wp config中的路径。php。看来我还得更新一下。htaccess?我也知道搜索/替换和mysql查询更新的序列化问题。
我有一个WPMS,我已经更新到3.5。我找到了包含域和路径信息的下表
移动到子目录
1之前的现有工作配置。wp\\U博客
select blog_id, domain, path from wp_blogs;
+---------+-------------+--------+
| blog_id | domain | path |
+---------+-------------+--------+
| 1 | root.com | / |
| 2 | root.com | /matt/ |
+---------+-------------+--------+
2。wp\\U站点
select * in wp_site;
+----+-------------+------+
| id | domain | path |
+----+-------------+------+
| 1 | root.com | / |
+----+-------------+------+
3。blog\\u id对应于包含以下内容的wp\\uu#\\u选项表:
select option_name,option_value from wp_2_options
where option_name = \'home\' or option_name = \'siteurl\';
+-------------+--------------------------+
| option_name | option_value |
+-------------+--------------------------+
| home | http://root.com/matt/ |
| siteurl | http://root.com/matt/ |
+-------------+--------------------------+
4。在我的wp-config.php 我有以下WPMS特定行:
define(\'WP_ALLOW_MULTISITE\', true);
define( \'MULTISITE\', true );
define( \'SUBDOMAIN_INSTALL\', false);
$base = \'/\';
define( \'DOMAIN_CURRENT_SITE\', \'root.com\' );
define( \'PATH_CURRENT_SITE\', \'/\' );
define( \'SITE_ID_CURRENT_SITE\', 1 );
define( \'BLOG_ID_CURRENT_SITE\', 1 );
5。最后,在我的.htaccess, 我有:
RewriteEngine On
RewriteBase /
RewriteRule ^index\\.php$ - [L]
# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [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).*) $1 [L]
RewriteRule ^[_0-9a-zA-Z-]+/(.*\\.php)$ $1 [L]
RewriteRule . index.php [L]
移动网站所需的更新在我看来,为了将我的网站移动到/博客,我会:
1。更新wp\\u博客至
mysql> update wp_blogs set domain=concat(domain, \'/blogs\'), path=concat(path, \'blogs/\');
select blog_id, domain, path from wp_blogs where blog_id < 3;
+---------+-------------+--------------+
| blog_id | domain | path |
+---------+-------------+--------------+
| 1 | root.com | /blogs/ |
| 2 | root.com | /blogs/matt/ |
+---------+-------------+--------------+
2。将wp\\U站点更新为
update wp_site set domain=concat(domain, \'/blogs\'), path=concat(path, \'blogs/\');
select * from wp_site;
+----+-------------+------------+
| id | domain | path |
+----+-------------+------------+
| 1 | root.com | /blogs/ |
+----+-------------+------------+
3。wp\\u#\\ u选项
+-------------+--------------------------------+
| option_name | option_value |
+-------------+--------------------------------+
| home | http://root.com/blogs/matt/ |
| siteurl | http://root.com/blogs/matt/ |
+-------------+--------------------------------+
4。wp\\U配置。php
define(\'WP_ALLOW_MULTISITE\', true);
define( \'MULTISITE\', true );
define( \'SUBDOMAIN_INSTALL\', false);
$base = \'/blogs/\';
define( \'DOMAIN_CURRENT_SITE\', \'root.com\' );
define( \'PATH_CURRENT_SITE\', \'/blogs/\' );
define( \'SITE_ID_CURRENT_SITE\', 1 );
define( \'BLOG_ID_CURRENT_SITE\', 1 );
note: 我不清楚这个步骤是如何适当更新的
5。我找到了含糊不清的“适当更新.htaccess”说明,但没有具体说明。是否更新RewriteBase?哪些行输入。htaccess在移动根目录时更新。com到根目录。com/博客?
上述过程中缺少的是在帖子中找到的路径。在我进行了更基本的更新之后,我的任务是使用搜索和替换工具;还是我错了?
更新bungeshea 建议,是的,我将RewriteBase指向“blogs”子目录,即。,
RewriteBase /Blogs
最后,如果你不知道
http://interconnectit.com/products/search-and-replace-for-wordpress-databases/ 你应该这样做。太棒了。