Skip to content
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

URL issues on multisite #250

Closed
felixarntz opened this issue Apr 14, 2016 · 18 comments
Closed

URL issues on multisite #250

felixarntz opened this issue Apr 14, 2016 · 18 comments

Comments

@felixarntz
Copy link

I have recently set up my first multisite with Bedrock, and I have encountered several issues where the URLs are not correct. After some investigation, I figured that the issues are a result of a problem in WordPress Core - in some places it does not honor the site URL setting. This is no problem with a regular WP install, but when WordPress is installed in a subdirectory as it is in Bedrock, the site URL is different from the home URL.

The most significant problem is that some areas in the network admin will direct me to /wp-admin instead of /wp/wp-admin, for example when you're on the My Sites section and click on "Edit Site".

To be clear, this is not a Bedrock bug, but I think it would be great if Bedrock provided a fix for it, so that other people do not run into this problem. While there are ways to workaround this with nginx / htaccess rewrites, I'd prefer to actually fix it from the code site. As of now, I have fixed these issues on my site, so I'll create a pull-request with my approach.

Btw I also created a ticket on Core Trac, the first responses told me that WP doesn't officially support this - so not sure whether there will be a Core fix soon.

felixarntz added a commit to felixarntz/bedrock that referenced this issue Apr 14, 2016
@iandunn
Copy link

iandunn commented Jun 10, 2016

@sandrodz
Copy link

sandrodz commented Nov 26, 2016

This is example .htaccess I shipped with project.

screen shot 2016-11-26 at 3 55 17 pm

nginx
screen shot 2016-11-26 at 3 57 10 pm

@sandrodz
Copy link

Btw, I'm including this info for someone who might end up here before your fixes are merged! I'm not suggesting this as a better solution or smth, your PR is awesome.

@dubcanada
Copy link

Adding

$url .= 'wp/';

To network_site_url function in link-template.php fixes it, but that's obviously not a correct fix.

For now what I did was use the network_site_url filter to fix the urls.

@henscu
Copy link

henscu commented Nov 30, 2016

@sandrodz do you have your example .htaccess and nginx configs above in a gist or webpage so that they can be easily cut and pasted?

@sandrodz
Copy link

sandrodz commented Nov 30, 2016

@henscu no, but I can provide them. I also have a very nice docker dev env for wp and laravel with respective nginx configs - I'm planning to share it soon - it contains correct configs for multisite too.

@henscu
Copy link

henscu commented Nov 30, 2016

@sandrodz that would be great. I'm also working on getting my Docker env going, and am looking at the entire workflow from initial generation of WP database & code in Vagrant using Trellis, then migrating the db from inside Vagrant to use with Docker and merging upstream changes from Trellis etc... I'm not sure if anyone else has done this yet...

@swalkinshaw
Copy link
Member

From #251:

I think this should be a separate plugin/package. Although the problem happens with Bedrock, it's a WP but not a Bedrock one.

If this was a standalone package, Bedrock could require or at least recommend it.

@smarterdigitalltd
Copy link

Hi all, I'm just going to leave this link here: https://github.com/felixarntz/multisite-fixes/blob/master/mu-plugins/wpms-site-url-fixer.php

It's not mine, but it works well for me. I've tried many times to get multisite (subdomain) + bedrock working on a managed WP host (I'm with Kinsta) with no luck, but after another 6 hours of tearing my hair out today, I stumbled across this.

Simply add it as an mu-plugin and define a constant in application.php for

define('WP_CORE_DIRECTORY', 'wp');

and that's it.

@felixarntz
Copy link
Author

@smarterdigitalltd I specifically wrote this with Bedrock in mind :)

@JulienMelissas
Copy link
Contributor

JulienMelissas commented Sep 29, 2017

Hey everyone! I've finally had a chance to take a look at this ticket. Please check out https://github.com/roots/multisite-url-fixer (install this as an mu-plugin, run composer install) and see if it works for you 😄 - it's working on my multisite for sure right now. If in fact it's working for everyone, I'll add it to packagist and to the bedrock multisite docs. Would love feedback ASAP.

Thanks again to @felixarntz for the og code (hi Felix!!).

@felixarntz
Copy link
Author

Very happy to read that this is now in official hands - thanks @JulienMelissas! :)

@Preen
Copy link

Preen commented Oct 4, 2017

Im getting

Not Found The requested URL /wp-signup.php was not found on this server.

with

define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('DOMAIN_CURRENT_SITE', env('DOMAIN'));
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1); 

Whenever I activate that plugin and use that config. Is there a guided tutorial somewhere to get multisite up n running with bedrock?

@greatislander
Copy link

@JulienMelissas The new plugin seems to be working for me. One question though… in @felixarntz's original repo, it says:

Everything here should only be used for subdomain (or domain) setups. Do not use with subdirectory setups!

Does this still apply? Thanks in advance.

@JulienMelissas
Copy link
Contributor

@greatislander, we're working on that over here: roots/multisite-url-fixer#2

Would you be willing to test? Would be a great help for me and maybe I could then close out these issues and finish this all up! Thanks.

@greatislander
Copy link

@JulienMelissas will do 👍

@JulienMelissas
Copy link
Contributor

Thanks for the feedback and testing @greatislander! I'm going to close this now with the solution of people using https://github.com/roots/multisite-url-fixer. Bedrock Docs are coming.

@JulienMelissas
Copy link
Contributor

@Preen - regarding your issue, can you please make a thread on Discourse and maybe someone can help you there? I think your issue might lie in define('DOMAIN_CURRENT_SITE', env('DOMAIN'));.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants