简体   繁体   English

子域中的Wordpress多站点

[英]Wordpress Multi-Site in a SubDomain

I'm having trouble getting my Wordpress multi-site installation working the way I want it. 我无法按我想要的方式来安装Wordpress多站点安装。 I have 3 blogs that I want working in subdomains, and I want to use the main domain as the main website for other things. 我有3个我想在子域中工作的博客,并且我想将主域用作其他内容的主要网站。

So, I want: 所以,我想要:

  • Main Blog: stephen.digitaleagle.net 主要博客:stephen.digitaleagle.net
  • 2nd Blog: linuxsagas.digitaleagle.net 第二个博客:linuxsagas.digitaleagle.net
  • 3rd Blog: psst0101.digitaleagle.net 第三博客:psst0101.digitaleagle.net

So, to log into the network, I would use this url: stephen.digitaleagle.net/wp-admin/network 因此,要登录到网络,我将使用以下网址:stephen.digitaleagle.net/wp-admin/network

I can't be the only one who wants it to work this way. 我不是唯一希望它以这种方式工作的人。 Instead, it seems designed to work with the main blog on the main domain and the other blogs as subdomains. 相反,它似乎旨在与主域中的主博客以及其他博客作为子域一起使用。

When I create the 2nd blog, it was: linuxsagas.stephen.digitaleagle.net 当我创建第二个博客时,它是:linuxsagas.stephen.digitaleagle.net

I have gotten part way there... 我已经到那里了...

Step 1: Created the site. 步骤1:创建了网站。 (I actually used WP-Cli) (我实际上使用过WP-Cli)

Step 2: I updated the wp2_option and wp3_option tables ... I changed the rows where the option_name field was siteurl or home. 步骤2:更新了wp2_option和wp3_option表...我更改了option_name字段为siteurl或home的行。

Step 3: I edited the site on the sites page and changed the URL. 步骤3:我在“站点”页面上编辑了站点,并更改了URL。

After those steps, the blogs show up on the correct URLs. 完成这些步骤后,博客将显示在正确的URL上。 My problem is that the admin logins don't work. 我的问题是管理员登录无效。 I don't get an error message. 我没有收到错误消息。 it just doesn't log in for some reason. 只是由于某种原因没有登录。

If it makes a difference, I am using nginx instead of apache. 如果有所作为,我使用的是nginx而不是apache。 I don't think that this the problem, because the URL takes me to wordpress. 我不认为这是问题所在,因为URL使我可以使用wordpress。

Is there a correct way to do this? 有正确的方法吗? Is this not supported? 不支持吗?

I finally figured it out by adding error_log() statements into the wordpress code and with this post: Can't log in: “ERROR: Cookies are blocked or not supported by your browser. 我最终通过在wordpress代码中添加error_log()语句并通过以下帖子来解决了这一问题: 无法登录:“错误:浏览器阻止或不支持Cookie。 You must enable cookies to use WordPress.” 您必须启用Cookie才能使用WordPress。”

I cleared my cookies for the site, and that's when I started getting the error message about cookies not being enabled for the site. 我清除了该站点的cookie,这就是当我开始收到有关未为该站点启用cookie的错误消息的时候。

I added this line to the wp-config.php file: define('COOKIE_DOMAIN', $_SERVER['HTTP_HOST'] ); 我将此行添加到wp-config.php文件中:define('COOKIE_DOMAIN',$ _SERVER ['HTTP_HOST']);

I'm still not sure if this is the "right" way, but it is working, and I guess that is what counts. 我仍然不确定这是否是“正确”的方法,但它是否有效,我想这才是关键。

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

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