0
votes

I'm trying to setup a wordpress multisite with no blog on /

I've got two sites

/sv
/en

and everything is installed in the root so I can access /wp-admin

The problem seems to be that the multisite setup requires one site in the table wp_blogs to be located at path = / to work.

I start by setting up an ordinary wordpress 4.1 setup on /sv which the nginx redirects to if / is visited.

I then want to add the english site and enable mutltisite in wp-config.php

and go through the network setup and add

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

But when I then try to access /wp-admin it says the database is not found, even though I know it works.

So my question is, can I setup multisite without a wp_blogs mapped to /?

1
Why don't you add an url redirect template on / ? So if somebody open your base url domain.tld/, it redirects to /en or /sv, so it looks like there is no main site.Harkály Gergő
The problem is that wordpress multisite doesn't seem to be able to work without a blog bound to /. I've already fixed the redirect from / to /sv with nginxLeon Radley
@LeonRadley it's not the problem actually, it's how the system supposed to work.WP Multisite concept is a "Network with main site".Ihor Vorotnov
@Ihor-paspar2.com But if I want the main site to be /sv and the secondary to be /en that isn't possible? I would still have to have a third site with nothing on it that would live under / ?Leon Radley
Yes, empty site with ID 1, and redirect it to /sv on the early stage. I'm adding the code as an answer right now.Ihor Vorotnov

1 Answers

0
votes

It's the way WP Network supposed to work - a network of sites with one main site. To get what you want, you need to have a main site (usually with ID 1) and on the very early stage redirect your users to a subsite:

function my_redirect() { wp_redirect( network_site_url( '/sv' ), 301 ); exit(); } add_action( 'init', 'my_redirect' );