Perhaps I’ve overlooked a step during setup, but shouldn’t there be redirects in place?
Adding a new subdomain site works fine and doesn’t have the same problem (e.g. sub.website.com/wp just 404s)
Another thing I should note is that I wasn’t able to go through the Network Setup for WP Multisite as that screen provides .htaccess rules and Trellis uses nginx (I’m not sure how to configure rewrite rules for nginx).
Or am I wrong in thinking that the site shouldn’t be accessible via both URLs?
@rhud I haven’t figured this out yet – tbh I moved on after spending to much time on it but I’d still like to get it resolved at some point.
@ben my configuration matches what’s in the docs except I don’t use ‘example.dev’ which I assume doesn’t matter. Just in case, I switched back to ‘example.dev’ but that doesn’t resolve the problem. Surely it’s something to do with nginx rewrite rules?
i have this problem now as well, did anyone try to solve the problem without going to db and change it manually?
my solution was to use wp option update home http://example.dev on the vagrant box current/ directory.
It’s strange that both siteurl and home are set to /wp. It could be that since wp gets auto installed, the settings for home somehow switched to siteurl one. I couldn’t find a way to set home programatically so it may be on some stage be put to the DB and loaded from there.
I also noticed that wp/wp-admin is used by the main site dashboard, but the network admin is loading directly from /wp-admin.
You don’t need any code to handle the ‘wp’ part in any admin urls. Instead an nginx rule will do it for you.
Assuming that neither the ‘home’ nor ‘siteurl’ options have ‘/wp’ in them (and they shouldn’t): I have this additional rule on my Bedrock-based site config (server block) to fix everything.
#subdomain multi site with wp in 'wp' subdir
if (!-e $request_filename) {
# Redirect wp-* files/folders
rewrite ^(/[^/]+)?(/wp-.*) /wp/$2 last;
# Redirect other php files
rewrite ^(/[^/]+)?(/.*\.php) /wp/$2 last;
}
It fixes all the problems!
Note, I think there is a faster way to do it than using rewrites, I just haven’t figured it out yet. It probably can be done with try_files.