3

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.

yivi
  • 42,438
  • 18
  • 116
  • 138
mcabe
  • 260
  • 3
  • 15

1 Answers1

0

Use a plugin called Duplicator

Or you have to update and your site_url link on your DB and navigate to WP Settins->Permalinks and click update to rewrite your htaccess file.

s1nb2
  • 82
  • 1
  • 7
  • Well since we already have migrated Duplicator isn't really an option. I assume you mean update permalinks for each site, right? I've just had to update the site_url in the db this morning so resaved permalinks in each site and I'll let you know if that helped, and if so accept your answer. – mcabe May 01 '19 at 06:55
  • Unfortunately can already confirm that resaving permalinks does not fix the issue – mcabe May 01 '19 at 07:01