We have a multisite bitnami subdirectory installation. Each subdirectory is a country specific site so the root site is https://example.com
and subdirectories are https://example.com/[country code]
During development on http://[ip] there were no issues. After moving to our domain and adding editors for each site we starting experiencing a very specific issue.
First off the details:
.htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
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]
</IfModule>
# END WordPress
wp-config.php
define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', false );
$base = '/';
define( 'DOMAIN_CURRENT_SITE', '[redacted].com' );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );
define( 'WP_HOME', 'https://[redacted].com' );
define( 'WP_SITEURL', 'https://[redacted].com' );
define( 'WP_2_HOME', 'https://[redacted].com/da' );
define( 'WP_2_SITEURL', 'https://[redacted].com/da' );
define( 'WP_3_HOME', 'https://[redacted].com/de' );
define( 'WP_3_SITEURL', 'https://[redacted].com/de' );
define( 'WP_4_HOME', 'https://[redacted].com/se' );
define( 'WP_4_SITEURL', 'https://[redacted].com/se' );
define('FS_METHOD', 'direct');
/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
/** Sets up WordPress vars and included files. */
define( 'SUNRISE', 'on' );
require_once(ABSPATH . 'wp-settings.php');
define('WP_TEMP_DIR', '/opt/bitnami/apps/wordpress/tmp');
The problem
Every now and then the option_values are changed in the wp_[id]_options
table for each site. E.g. select * from wp_2_options where option_name = 'siteurl';
option_value
will change to the root url instead of the root url + subdirectory (i.e. https://example.com/
instead of https://example.com/[subdirecotry]
). The result is that the admin links in the dashboard exclude the subdirectory in the urls. This can result in 404s since a post id doesn't exist in the root directory, admins can only access the a site specific dashboard by entering the subdirectory in the url bar manually, changes to posts (pages, blog posts, templates etc that have been copied from the root direcotry and thus share a post id) get saved to root directory instead of the subdirectory etc.
Nothing breaks on the user end. All links on the site itself are fine.
Whenever we experience this or it is reported we have to manually change the option_value
in the corresponding wp_[id]_options
table back to the root url + subdirectory and roll back to an earlier post revision. This is annoying to say the least.
First we thought it was an issue related to the domain move, but we didn't start experiencing this until we started adding admins, editors, seo-managers etc. Then we thought just maybe if a user had roles across different sites, it would break when they authenticated, but eliminating that variable did not stop the problem from reoccurring.