-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multisite support #58
Comments
Scott - I've actually solved this issue two ways. Using a filter to rewrite the urls, or actually using the rewrite rules for nginx that I was asking about in another issue and posted a solution for. Once those rewrite rules are in place, multisite works as intended, and you don't need the /wp portion in the url any longer. |
@etcook I actually used your rewrite rules for a MS test install and they worked. But that was when I installed WP normally, then activated multisite from within wp-admin. I also tried a fresh install through |
In both cases, was there a disparity with your home and site url settings? /wp should be removed from both. |
Probably was since with a standard Bedrock install it would be:
I'll have to do more testing |
That's correct - but with the rewrite rule, the /wp subdirectory is no longer necessary. Makes for a cleaner multisite install overall, but admittedly takes a bit of human intervention depending on how you're setting it up. I'd make the rewrite plugin optional, however. Adding such a filter would create unexpected behavior, at least until the bug is resolved. The issue doesn't seem to really be taken seriously at this time. I don't mind showing you my current setup if you have any interest. |
@swalkinshaw: I got it to work fine, yeah, albeit not necessarily the way you'd want it to work. In essence, I filter siteurl so it returns the home url, and I mess around with the WP rewrite rules and cookies so that nothing breaks when doing so. In doing so, WP in /wp will always return admin urls like /wp-admin, multisite or not, and that fixes all of the problems indirectly. The code involved is here: https://gist.github.com/ddebernardy/10529951 The actual bug fixes plugin it's part of should get released shortly as a composer package — I basically need to write a whole bunch of unit tests for it, for my mu-plugin loader and for the wordpress bridge and wordpress bundle packages that they both depend on. ;-) An alternative approach, which I also tried, is to filter the network admin urls so that they point to e.g. /wp/wp-admin/network instead of the incorrect /wp-admin/network values returned by WP. The main merit of doing so is simplicity; personally, I prefer getting /wp-admin urls. |
@ddebernardy that's a lot of code! Ideally Bedrock would support MS as easily/simply as possible. And it really isn't far off from that now. In fact I think the only main issue is how WP-CLI does multisite installs from scratch. Although the "simplest" method requires rewrites. Looking forward to seeing your Composer packages though and thanks for checking :) |
In that case, a simple filter on the network admin urls (and user admin urls) so as to fix the folders' directory is the way to go. I'm pretty sure I documented a (partial) fix to that in one of the tickets you referenced. Re the packages, it's in unreleased alpha state, but you can try the package here:
Then run composer install in there, or ./bin/update. Configure by renaming and then editing the dist files in app/config as appropriate. (And yes, it's very much like bedrock or the Mark's WP Skeleton). :-) |
I can't seem to get this working. I cannot login on the main website in a multidomain multisite installation. I used this
The login on the main page just comes back to the same page without any errors. |
I'm using this .htaccess on litespeed and it works fine
I dont see much difference other than the slashes before wp/$1, try without it but I dubt that is the problem stuff you could try:
|
Our situation is that we have a multidomain multisite with domain mapping plugin. I don't think we can get it working for now... Multidomain multisite is still way too buggy to start moving around the structure of wordpress itself. |
well i'm using it with https://wordpress.org/plugins/wordpress-mu-domain-mapping/ and it works although it needs some configuration, but i didn't have login problems (both with remote logins and logins on main site) There are some quirks with bedrock+multisite+mapping but its not broken, some documentation could help, @swalkinshaw how about enabling the wiki for this repo? |
@francescolaffi wow didn't even realize it wasn't. Enabled now. |
@francescolaffi That sounds interesting. Do you have an example configuration / setup somewhere? On the main website we keep getting errors about cookies being blocked on the browser. But it's possible to login in a subsite in the network. So that's weird. |
I dont have a public repo for that project but I'll make a wiki page with a working config Cookies blocked probably means it cant set or verify the test cookie, I guess its a misconfiguration of the cookie domain. Anyway you should check with browser tools or curl if the domain for wp cookies is correct by http standards: try maindomain.tld/wp-login.php it should be something like .maindomain.tld if it is a subdomain install I had a similar problem when I misconfigured |
For reference, in case this helps someone, these are the steps I took to get multisite working with Bedrock correctly:
|
The steps above work nicely. Thanks @danielck ! |
Glad to hear it! You're welcome.
|
Why would you put the multisite constants in three different environment files rather than application.php? |
Question of workflow. You can't put everything at once in the config, before you've run network setup. And I assume you'd want to test first in development before starting the process in staging or production. But it all depends on how you do deployments (we don't use Capistrano) and in the end you can just move everything into application.php anyway. Daniel
|
@etcook Presumably you could just set this in application.php
And then make sure to add the new line to your .env |
@francescolaffi Did you ever get a chance to share your working multi-site multidomain configuration tweaks? I'd be intrigued to see them as I'm about to try setting one up. |
@alexleonard I'm not sure what you're referring to in your first post. Re the second: I have zero issues with multi-site, multi-domain, and I rewrite away the wp directory. I'm using the same htaccess as @francescolaffi posted above on Apache, and have a similar config for nginx working. Nothing fancy needs to be done. |
I'm trying to configure a bedrock multisite and the @danielck solution works for me. However i think there's an issue with bedrock autoloader, all the mu-plugins loaded in composer.json as mu-plugins that are located in subdirectories are loaded correctly but not listed in the admin page (roots/soil for example). Moreover i can't see anymore the asterisks next of the plugin name. |
I'm creating a multisite implementation and was wondering if the above posts are generally referring to sub-directory or sub-domain mode? I'm going to use the domain mapping plugin eventually but want to get it working without this first. |
@robganly I went with sub-domain mode. My first attempts with sub-folder mode didn't seem to work, but that said, I didn't spend too long on it. Domain mapping worked well. The setup is a little ungainly and moving from local -> staging -> production is a bit of a pain in the ass (you need to step by step work through database changes - I do wish WP just handled domain settings in config files - or at least had an option to). @etcook Heh, I can't remember exactly - I think you'd asked a question about why was config stuff spread around various files. |
I can confirm that the rewrite rules suggested in #58 (comment) work just fine, as evidenced by roots/trellis#116. After adding the necessary multisite constants, Bedrock works with aplomb. |
Install instructions based on: roots/bedrock#58 (comment)
I'm encountering the same problem as described by @starise : the plugins' files are in the mu-plugins folder, but not listed in admin (plugin page). |
How about nginx rewirte codes?? |
There's a few features of Bedrock that might make some Multisite setups a problem:
Looking at some issues regarding this, it seems like MS support is still a bit of a mess. Related issues:
Here's a potential
mu-plugin
we may want to consider adding in Bedrock by default: https://gist.github.com/danielbachhuber/9379135/cc @ddebernardy I'm hoping you can speak to/summarize some of the issues you've ran into and potential solutions.
The text was updated successfully, but these errors were encountered: