简体   繁体   中英

Wordpress Multisite Database Error

I tried setting up the multisite for WordPress, and I added the following code to my wp-config.php on my main installation.

define('WP_ALLOW_MULTISITE', true);
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('DOMAIN_CURRENT_SITE', 'my.example.site');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

My .htaccess on my main domain looks like this:

# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]

# END WordPress

I added the extra site as I should. It is a subdomain of a subdomain, so sub.my.example.site. Once installed, I made a subfolder in my WordPress folder, and pointed a subdomain at the folder in cPanel.

In wp-config.php on the subsite, I have the following code:

define('WP_ALLOW_MULTISITE', true);
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false );
define('DOMAIN_CURRENT_SITE', 'sub.my.example.site');
define('PATH_CURRENT_SITE', 'sub.my.example.site');
define('SITE_ID_CURRENT_SITE', 2);
define('BLOG_ID_CURRENT_SITE', 2);

If I set SUBDOMAIN_INSTALL to true, it redirects to the following:

http://sub.my.example.sitesub.my.example.sitewp-signup.php/?new=sub.my.example.site

Anyone in here know how to fix this issue? The sites are set up on two different databases, and the databases are working as they should.

I figured it out. The fix is to not create a subdirectory in your FTP, nor create a new database for the multisite.

I pointed the subdomain to the root of the website and removed the subdirectory. Everything works now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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