I have a multisite installation that seems to be working just fine for the first site, but for the second site, the admin panel results in a "too many redirects" loop. What is the correct nginx or wordpress configuration to get this to work?
I have a non-WordPress installation at example.com
My first blog is setup at example.com/blog
My second blog is setup to be example.com/blog/tr
. The frontend renders just fine.
The admin for the first site works just fine, as does the network admin panel.
So https://example.com/blog/wp-admin
and https://example.com/blog/wp-admin/network/
result in pages that work fine. The url https://example.com/blog/tr/wp-admin
results in too many redirects, though.
My nginx configuration for the wp-admin sections looks like this
if (!-e $request_filename) {
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
rewrite /wp-admin$ $host/$uri/ permanent;
rewrite ^(/[^/]+)?(/wp-.*) $2 last;
rewrite ^(/[^/]+)?(/.*.php) $2 last;
}
Here are my wp_blogs and wp_site tables
mysql> SELECT * FROM wp_site;
+----+-------------+--------+
| id | domain | path |
+----+-------------+--------+
| 1 | example.com | /blog/ |
+----+-------------+--------+
mysql> SELECT blog_id, site_id, domain, path FROM wp_blogs;
+---------+---------+-------------+-----------+
| blog_id | site_id | domain | path |
+---------+---------+-------------+-----------+
| 1 | 1 | example.com | /blog/ |
| 2 | 1 | example.com | /blog/tr/ |
+---------+---------+-------------+-----------+
wp-config.php
define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', false );
define( 'DOMAIN_CURRENT_SITE', 'example.com' );
define( 'PATH_CURRENT_SITE', '/blog/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );
I’ve tried changing the path for the second blog, to something with a different path like /blg/tr
in case it was a path collision error, and I was still getting the problem. I also tried creating a second site in wp_sites and associating the second blog with that second site, also didn’t do anything different.
I also put in specific nginx location blocks for specifically /blog/tr/wp-admin
and that seemed to break it more in different ways.
Is there anything I am missing or additional documentation that I am not finding to help debug my second site’s wp-admin section?
Reviewed documentation / suggested steps:
https://wordpress.org/support/article/debugging-a-wordpress-network/
https://www.wpbeginner.com/wp-tutorials/how-to-install-and-setup-wordpress-multisite-network
https://gist.github.com/JustThomas/141ebe0764d43188d4f2
Trying to access second site dashboard on a multisite configuration proceeds to an error
https://docs.bitnami.com/aws/how-to/troubleshoot-wordpress-issues/