WordPress.org

Ready to get started?Download WordPress

Forums

[closed] What's the core logic of Multisite ? (21 posts)

  1. FMaz008
    Member
    Posted 3 years ago #

    Hi,

    Ok, first, I've read many tutorial that explain the How, but never the what or the why. So here's what I've tried yet... I would appreaciate if you could point me out where I've made a bad assumption:

    Right now, I have 2 WP installations:
    - mysite.com/fr/
    - mysite.com/en/

    Ps.: Do not go offtopic by suggestion Translation plugin please, let's pretend it's 2 different blog, not translations.

    I wanted to use WP MU to manage both at the same time, like on wordpress.com, when you have multiple blog on a single account.

    So I go in the /fr/ installation, and follow the steps to activate MultiSite. Now I have the SuperAdmin box. So I go in sites, and try to link the /en/ installation.
    First of, the interface seemed weird, I must enter a path, but the following prefix is mandatory:
    mysite.com/fr/ [ input box ]

    So I try "../en/" , but it doesn't work.
    So I enter "en", and then when the "mysite.com/fr/en/" site is created, I edit the path in the modify page to put "mysite.com/en/"

    Now I go in the Super Admin / Themes tab, and make sure my child theme and the parent theme are allowed on the network.

    And then I Update the network.

    I connect myself to the admin panel of my /en/ installation, but the child theme is not there at all.

    Can someone explain me the basic logic behind Multisite ?
    - Does it LINK existing workpress installation in a super-admin panel ?
    - Do I need to activate Multisite on ALL installations that I want to manage ?
    - Is it only 1 big installation, called Multisite, that emulate many blog (so I do not have to make multiple installations, as they are dynamicaly created on the fly)
    - Why is there a mandatory prefix ? It's like if I *HAD* to have a WP installation on the core domain, then the child site have to be on subdomain or subfolder, but couldn't be in parent or same level.

  2. - Does it LINK existing workpress installation in a super-admin panel ?

    NO, it does not. once you activate the network, you create new sites in the same install. this is exactly how WordPress.COM works.

    - Why is there a mandatory prefix ? It's like if I *HAD* to have a WP installation on the core domain, then the child site have to be on subdomain or subfolder, but couldn't be in parent or same level.

    Because not everyone wants the same setup. If you want multiple top-level domains, there's a plugin for that.

  3. FMaz008
    Member
    Posted 3 years ago #

    Ah... I see, thanks :)

    Could you point me out the plugin for the multiple top-level domain ?

    Just to be sure, for you, there is no distinction between "top-level domain" and "same level folder" ?

    My case is really:
    - mysite.com/fr/ <!-- One site, multisite installed from here
    - mysite.com/en/ <!-- another site

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 3 years ago #

    FMaz008: This might help:
    http://ottopress.com/2010/wordpress-3-0-multisite-domain-mapping-tutorial/

    But note that yes, your main install must be at the root. You can't make "same level folder" installs work on multisite.

    Create the main site at the root, then the subsites in subfolders.

  5. FMaz008
    Member
    Posted 3 years ago #

    But I'm on the same domain, no ? (mysite.com)

    I must consider my case as 2 distincts domains ?

  6. Samuel Wood (Otto)
    Tech Ninja
    Posted 3 years ago #

    No, you must consider that WordPress can't make same-level folders because that's not how webservers work.

    If your main site was example.com/whatever/, then all the sub-sites must be underneath that. It can't magically go back a directory and create side by side things.

  7. FMaz008
    Member
    Posted 3 years ago #

    You mean because it need an .htaccess to parse the URI and determine the route to the correct blog ?

    What if I put & tweak the .htaccess in mysite.com/ ?

  8. Samuel Wood (Otto)
    Tech Ninja
    Posted 3 years ago #

    No, it doesn't use an .htaccess to determine the route or parse the URI. It does that internally.

    If you want to have side by side sites, then the main site must be below them, at the root URL. No way around it.

  9. FMaz008
    Member
    Posted 3 years ago #

    Why your saying their's no way arround ? Technically, it's possible.
    The idea is to forward all request from / to /fr/.

    Request:
    mysite.com/en/article12

    Parsed by mysite.com/.htaccess

    Then the following rewrite would occur:
    mysite.com/fr/en/
    to
    mysite.com/fr/

    And then the mysite.com/fr/.htaccess file would thread the request again, not even knowing that it has been previously rewrited.

    So the /.htaccess file should handle 2 exceptions cases:
    - The main WP installation ( in this case /fr/ ) as we don't want the result to be /fr/fr/
    - The files in / , in my case that would be a static negative condition. So, do not rewrite everything that doesn't match: (\/fr\/(.*)|\/en\/(.*))

    My not a pro with rewrite, but I'm sure that's possible, and I'll prove your "No way around it." statement to be wrong ;)

  10. FMaz008
    Member
    Posted 3 years ago #

    Hum, your right, WordPress doesn't take in consideration the $_SERVER['REDIRECT_URL'] variable in his route handling system, so the URL treated by WordPress is the URL in the browser bar, not the real one on the server in case of a redirection.

    I've open a enhancement bug request about that with a fix suggestion.

  11. but I'm sure that's possible, and I'll prove your "No way around it." statement to be wrong

    Considering a good half a dozen core devs, including people behind WordPress.COM say it's not possible and have spent literally months trying to figure it out....

    feel free to try.

    Also, the only people who have ever come close and says it's working either:
    - did really convoluted server horking
    - can't login to the backend of subsites

  12. FMaz008
    Member
    Posted 3 years ago #

    Don't want to be mad about anyone, and I'm not better than anyone. But technically speaking, wordpress is not known for his good code.

    If you search in the whole wordpress code base, they never use the php $_SERVER['REDIRECT_URL'] variable. That's just weird, and that's why I pointed that out in the ticket I've openned.

    Quoting mfyahya from php.net:

    If you use Apache's redirection features for custom error pages or whatever, the following Apache's REDIRECT variables are also available in $_SERVER:
    $_SERVER['REDIRECT_UNIQUE_ID]'
    $_SERVER['REDIRECT_SCRIPT_URL]'
    $_SERVER['REDIRECT_SCRIPT_URI]'
    $_SERVER['REDIRECT_SITE_ROOT]'
    $_SERVER['REDIRECT_SITE_HTMLROOT]'
    $_SERVER['REDIRECT_SITE_CGIROOT]'
    $_SERVER['REDIRECT_STATUS]'
    $_SERVER['REDIRECT_QUERY_STRING]'
    $_SERVER['REDIRECT_URL]'

  13. FMaz008
    Member
    Posted 3 years ago #

    I'm still investigating and testing stuff, but I'm now able to display the /en/ site correctly, by using my rewriting of /en/ to /fr/en/.

    I've done alot of try & error, so it's not a definitive solution, but it turned out that I've been able to solve part of my problem by doing the following mod:

    Near the line 67 of the file ms-settings.php, I've remplaced this:
    $blogname = htmlspecialchars( substr( $_SERVER[ 'REQUEST_URI' ], strlen( $path ) ) );

    By this:

    $reqUri = isset($_SERVER['REDIRECT_URL']) ? $_SERVER['REDIRECT_URL'] : $_SERVER[ 'REQUEST_URI' ];
    		$blogname = htmlspecialchars( substr( $reqUri, strlen( $path ) ) );

    This first path will load the good site, but the "article fetching" will not be ok. You'll have the good site loaded, but it will report the error message "article not found".

    To solve that part, I have to modify classes.php, WP::parse_request() method, near the line 161, replacing:
    $req_uri = $req_uri_array[0];

    By:
    $req_uri = isset($_SERVER['REDIRECT_URL']) ? $_SERVER['REDIRECT_URL'] : $req_uri_array[0];

    Now I have the front page displayed correctly in the good site. Next problem: all the links are using the /fr/en/ path. So it must be related to some kind of ROOT_PATH_URL constant or something like this.

    I'm still investigating.

    Note: My admin panel is accessible in both /en/wp-admin/ and /fr/en/wp-admin/ , but as all the link redirect to /fr/en/, I'm redirected there as well after the login.

  14. Samuel Wood (Otto)
    Tech Ninja
    Posted 3 years ago #

    You know, you're going to an awful lot of trouble when all you have to do is install WordPress at the root of the site. It's pointless. Just move WP to the root, then install both fr and en as separate sub-blogs. Done.

    It's simpler when you do things the right way.

  15. FMaz008
    Member
    Posted 3 years ago #

    TLDR: It's broken, I'm fixing it.
    -------

    Think out of the box; WordPress is a blog system, and we're not all using WordPress as a CMS, but often as a part of larger sites.
    I have a site at the root of the domain, I can't ovewrite it with a wordpress installation. What I could do is to create a /blog/ folder, and then install it inside, but that would be against the SEO planning of my client.

    I might go in alot of trouble, but for me, it only point out that there is a trouble in the system. I'm on the way for fixing a problem. And listening to you, I'm not the first who seem to ask for that feature, so I don't think that it's pointless to get involved in the developpement of that compatibility feature.

  16. I have a site at the root of the domain, I can't ovewrite it with a wordpress installation.

    You don't have to overwrite it.

    You could choose to ONLY use WordPress for the index page and have the rest of your site be what it is. Or you could import your site and make THAT run by WordPress.

  17. FMaz008
    Member
    Posted 3 years ago #

    What kind of community am I into ?
    Stop trying to figure out what my needs are for me...

    I might not be a wordpress expert, but I know what my needs are. I've asked for help, at first on a concept I did misunderstood, and after on a very specific problem that I should not have to justify over a certain point, point that has been reach in my opinion.

    I do have the need to use a parent redirection, and every apache server with mod rewrite enabled is natively compatible with cascading redirection. (with a configurable maximum to avoid infinite loop)

    I've find out that wordpress doesn't use the standard right, and in some special case, it cause a problem. I've also advance the beginning of a fully backward compatible fix to that problem in order to improve the project, and there are still people to try to tell me what to do instead of being constructive.

    Do you realize that with such an attitude, wordpress MU would simply doesn't exist at all ?
    - I would need to manage all my wordpress site from a single installation.
    - That would be really hard to do, I've talk to like 12 uber-gurus and they all told me that would take months to do, and that would be very complicated...
    - Ok then, I'll contribute by doing it myself, that's the open source mind right ?
    - But why do you need to administrate all your site in a single administration panel ? You're getting yourself alot of trouble, that's pointless.
    - Well my client have specific needs, and in our particular case, we need that in order to improve our management.
    - Man, just install 2 distinct wordpress and tell him to open 2 tabs in firefox and then you'll have your 2 panels right here.
    - That's now what I need.

    "Considering a good half a dozen core devs, including people behind WordPress.COM say it's not possible and have spent literally months trying to figure it out...."
    I've spend like an hour or 2 and I'm almost there yet. They just didn't read well enough the apache manual, or the php one. That happen all the time, even to guru, no one knows everything.

    "It's pointless."
    I'm fixing a bug here... And you know what, I'm doing it for free !

    "You don't have to overwrite it."
    Yes I would have to, I think I know what I'm talking about, I coded the whole site myself. My index page is a front controller, not a simple index.html file. To make an image, it's like if you where telling me that I could install 2 wordpress system in the very same folder... Both system are routing URL, so both need the index status in their folder.

    Maybe your doing pure HTML site when your not doing wordpress stuff, and that's fine, but try to understand that your reality is not necessarily the same as mine.

    -----
    Bottom line:
    You all seem to like plugin. For you, plugin is freedom right ? Then why is it so hard for you to consider wordpress the same as a plugin: A modular tool, like a forum, or a shopping cart.

  18. You're in a community of people who are helping you, for free, and telling you what we've all learned from a collective decade+ of using this software. We're trying to help you avoid the pitfalls and skip ahead to the 'how it works' part. We're attempting to help you, and warn you, and possibly find alternate solutions. One of which may be that WordPress, as it stands today, may not be what you need.

    Yeah, I'm not afraid to say that!

    Here's the status quo today:

    Installing WordPress in a subfolder and having it 'act as in root' (as it were) is a bit of a nightmare. It doesn't work, people who are actually paid to be smart about this sort of thing have bloodied their heads on the wall trying to make it work. It doesn't without a tonne of workarounds that all have problems and complications (like being able to log into sub-folders/domains etc). Yes, SOME people have claimed to 'make it work', but in all cases, it turns out to be that they've hacked WordPress in such a way that they still have those fragging problems. If you want to join their ranks, have at.

    Or. You can think of alternates.

    You don't want WordPress in root because it'll be too much work to sort out how to convert your custom crafted code into a static front page (which, by the way, does NOT have to just be plain HTML, and with a bit of work, I'm quite positive you could make it be your font controller). But fine, that's your choice, I respect it.

    How about considering a different URL structure? Install it in /lang and have domain.com/lang/en etc as your URLs? That's ZERO extra work.

    Bottom Line:
    We've already been there, done that, got the shirt, read the book about the PITA it is to have WordPress MultiSite write to a folder it's not in. Yes, it's modular. No, it's not perfect. If you can fix it, great! If not, you work with what you've got.

    I'm done, though, man. If you can't appreciate the free help and advice, you're on your own.

  19. firstep3
    Member
    Posted 3 years ago #

    Actually, you should be able to go to your server settings and control which index file takes priority in getting loaded, and this will solve your problem. For example, I have a setup where WordPress is installed at the root level, and then has three blogs in sub-folders.

    site.com is where WordPress is installed
    site.com/blog1/
    site.com/blog2/
    site.com/blog3/

    My hosting company provides a control panel where I can select which index file gets loaded first, so even though WordPress installs a file called "index.php", my server recognizes that "index.asp" has the higher priority. As a result, when someone goes to my site, they see the original site without any references to WordPress. I provide links to each separate blog for the users, and I have my own bookmark to the login page for WordPress so that I can get into the SuperAdmin section.

    This is a MUCH simpler example of "thinking outside the box", and it doesn't involve trying to recreate the wheel or forcing the product to do something it clearly wasn't intended to do.

  20. FMaz008
    Member
    Posted 3 years ago #

    If it wasn't because if all that spaggetti code, it would be really easy to fix.

    If the routing correction require only to patch 2 lines of code, the link generation apear to require alot of fixes. That would be possible, it's just a matter of finding where to apply all the fix, and the sites have all the required configuration already in place to do so.

    But you convinced me that the wordpress community prefer to keep their old reflexes of doing thing a specific way instead of working together as a unified force toward the improvement of the software.

    I don't know how many of you are actual PHP developper on WordPress, versus end-user and/or designer, but I've already proved it was possible with really small fixes, it's only a matter of how much fix are necessary do to in order to fix the wrong behavior.

    Finally, contributing to a open source must be encouraging, and the reactions in this topic are not an example of what open source contributions should be.

    So my contribution on this will end here.

    Many people dream of success. To me success can only be achieved through repeated failure and introspection. In fact, success represents 1 percent of your work which results only from 99 percent that is called failure. (Soichiro Honda)

  21. I don't know how many of you are actual PHP developper on WordPress,

    Two of us in this thread are directly involved. Yes, as core contributors.

    Finally, contributing to a open source must be encouraging, and the reactions in this topic are not an example of what open source contributions should be.

    Normally we're pretty friendly until people start flinging insults. ;)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.