The MU forums have moved to

Several blogs, different subdirectories, different domains (11 posts)

  1. Madoc
    Posted 15 years ago #


    after some searching in these forums, I found no article regarding my question. Since the question is not an easy one, I separate it into different parts.

    While answering my questions, place consider the following restrictions:

    - I cannot modify the Apache configuration, since my provider does not allow it.
    - I have no shell access and cannot do things like make soft links etc.

    Part 1:

    I want to set up WP-MU for several private blogs of my own. (Since the topics are so different that it would make no sense putting all in one blog.)

    Those blogs shall lie in different directories. The categories for my homepage are organized in several folders. Let's assume a structure like this:


    Now, I want to have blog URIs like this:


    (Appending "/index.php" to the URI would be acceptable.)
    Then I would have a kind of "logical" URI structure.

    Problem 1: As far as I can see from the documentation, WP-MU requires _one_ and only one prefix for all the blogs (e.g. "/blogs").

    I could copy the "index.php" of WP-MU to each of those blog directories, but I doubt that this would work. What else files would I need to copy? All of them? (I'd rather have WP-MU installed in just one place in the file structure, with the other places referencing to that one.)

    It would be okay if those URIs just work for viewing and commenting the blog articles, but not for editing. I could use a central URI (like "/wpmu-admin") for adding new posts, editing some, reviewing comments, etc. But the client must be able to display and comment the posts at the URIs mentioned above.

    Part 2:

    Because I write some things in English and some in German, I made two different subdomains, like: "" and "". Both subdomains will of course have different blogs, but similiar URI structures. (So, in order to switch from English to German, You might for example change the URL from "" to "".

    I would be acceptable to have two different WP-MU installations, one for the German and one for the English part. But I would prefer having just one, since users then don't have to create one account per language.

    Would that somehow be possible?

    Part 3:

    This is more like a request for a plug-in, or maybe a point in some WP programming documentation. I would like to be able to include the newest articles of one or more blogs into other pages as well. Is there an easy way to do so, in "WP foreign" pages? (I don't want to use an iframe for that, no way.) Because I am a programmer, I could easily call some nice WP functions from another PHP page, I just need to know which ones.

    Thanks for Your attention!

  2. bradmkjr
    Posted 15 years ago #


    I think you need to consider the number of blogs you are actually going to have, and if it is under 10 total, it might be overkill to use MU. You will probably find that without control of your server, trying to get 1 MU on two subdomains will be very tricky, and if you are trying to get the same blog names on 2 subdomains I don't think that will work with MU.

    I think it would be best to work with a slightly modified version of standard WP, and put the "common" files into a common folder, for example wp-content, wp-includes. This way you can update those folders without much issue. If you want to modify a theme or plugin it exists in 1 place for all blogs.

    With a directory structure like this:


    There are ways to achieve what you want with MU, but due to the lack of control of your server it might just end up being bigger headaches.

    Part 2, users? you said these where personal blogs? If you mean for comments why not check out something like openID, which will authenticate users on all the blogs.

    Part 3, because each blog is an RSS feed, all you need is a little magpie script. Or you can just query the db for the newest posts. There is a nice plugin floating around for mu, which could be adjusted for multiple wordpress installs.

    I hope I didn't discourage you from trying this out, but it just seems to me like the frustration will out way the gains. Once you have the blogs setup you can submit posts via e-mail or similar tools so you don't have to login to each blog every day to post.

  3. lunabyte
    Posted 15 years ago #

    Another trick, since it's your "private" set-up would be to use a little "trick" for regular WordPress that lets you use the same files but serve 2 different domains from them. You would have to search the main WordPress forums for the topic, I think it was last August or July, but it might work better for your situation.

    No need to modify apache with it, other than parking a domain op top of your account.

    Then you can just use categories to make the "directory" structure, and have the nice feature of being able to search the entire site without issues.

    You can write the site to give the appearance that it's sites within a site, all from the directory structure. Then, tag/categorize as appropriate.

    If the above recommendation isn't quite what you're looking for, you could just use 2 copies of WP, one per domain.

  4. Madoc
    Posted 15 years ago #

    Hello bradmkjr,

    (Where I am, it's actually late afternoon right now. But good morning to You anyway!)

    Thanks for Your answer. I think I got the point: It would be easiest to just use mutiple, separate WP installations. Actually, this was what I was up to before discovering MU.

    Maybe I can "extract" the common WP include files, move them into a common folder as You described and change the "require" statements of the various installations to search there. I will check that. (I'm a programmer, but not in the area of PHP. But I think it's not going to be much of an issue.)

    Yes, those are only personal blogs. I intend to have accounts required for posting comments. So there is some "tracking back" of the comment writer, I really don't want truly anonymous comments. Your OpenID recommendation looks interesting; I will check this. If it can be nicely integrated into WP, that's probably what I will use. (But I have to consider if using OpenID as an external service would be too much of a threshold for suspicious users - "Hey, why shall I give my email address to that service?".)

    Part 3 - including posts on other pages: I wouldn't use RSS here. It's just not elegant - one PHP script would query RSS content from its own server, then reformat it to HTML. Rather, I would like to read the posts from the DB. But I wouldn't do that directly; I would rather use the WP API. However, I understand that this topic should go into the WP-single forum.


  5. drmike
    Posted 15 years ago #

    You would have to do some coding as well because I don't think your subdirectory setup that you want would work with the standard WPMu setup.

  6. lunabyte
    Posted 15 years ago #

    Sure it would, with no additional coding.

    You only "need" 2 blogs, from the look of it. 1 for each domain (or sub, in this case).

    The rest can be done with categories.

    2 copies of WP, maybe a single one if both en.whatever and de.whatever subdomains point to the same location, and you "massage" WP to accept requests for either of the two. Simple check in the config file that switches the db connection from one db to another, or just switches the table prefix.

    Whether "" or "" is served out of a category structure or physical structure is kinda irrelevant. The links would still be the same. Just 1 would require a lot less heartache and less files and such.

  7. Madoc
    Posted 15 years ago #

    Hello lunabyte,

    thanks to You as well! Nice to see that two qualified answers came in whithin such a short time.

    Yes, it would be nice if I could somehow "tag" the articles for the different blogs. Then, from the perspective of WordPress, it would only be one large blog. It's only that the different "virtual" blogs would filter the articles shown in them. (Somehow, I presume I could manage to use different skins for the different "virtual" blogs.) This would be the solution I would like the best - if it can be done without any dirty hacks or the like.

    However, when using categories for this tagging, those would probably be top-level categories. The "real" categories of the different blogs would be sub-categories of them. So I would need to have a way to make the top-level categories "invisible", and display their child categories as if they were top level categories. I don't think this can be done without changing a lot in WP. But then again, maybe I could live without that change.

    Maybe a little more disturbing are RSS feeds: They would have to be filtered too. I think standard WP does not offer a functionality getting an RSS feed for a specific category only, does it?

    Anyway, I will do some experiments with WP on the week-end.

    Thanks for Your advice!

  8. drmike
    Posted 15 years ago #

    I thought they were trying to put seperate blogs into those subdirectories. If it's just categories, heck yes, built in.

    I'm looking for outstanding issue for Donncha. I'm skimming. Please forgive me. :)

  9. lunabyte
    Posted 15 years ago #

    That's the beauty of it Madoc.

    You make a category called "project", then put sub cats below it. Never tag a post as "project".

    Then make a page called "project", and use a custom page template.

    Pull information from all the "sub-cats" of "project", and it would look like top level cats.

    Navigation would be the same way, and it would only list subcats of "projects".

    I don't see a need for any hacks to the core, but you would have to be a little creative with your template files.

    Mainly, using the same overall code structure, and the doing something like a stristr and checking the uri for /projects/, /personal/, or whatever you want as the "top" level.

    Then if the stristr returns true, like /projects/ is in the request_uri, then use "this stylesheet", to which you specify the location.

    With WP, or even MU if you really wanted to, nothing says you have to call style.css from the theme.

    You could do something like this:
    `if ( stristr($_SERVER['REQUEST_URI'], '/projects/') ) {
    echo ' <style type="text/css" media="screen">
    @import url("");
    } elseif ( stristr($_SERVER['REQUEST_URI'], '/personal/') ) {
    echo ' <style type="text/css" media="screen">
    @import url("");
    } else {
    echo ' <style type="text/css" media="screen">
    @import url("");

    Just as an example.

    Then, you customize the css for each one, changing colors, images, etc.

    Similar layouts, to keep it somewhat "familiar" to the user, but still different enough to give each it's own Flavor.

    You'd so similar checks throughout your templates.

    "Maybe", instead of stristrs all over the place, you set variables instead, and do it inside the header file, before all the other stuff actually starts. Might shorten up some checks and such.

    Just a few thoughts, really. But it could be done without "too" much trouble at all.

    To "really" do what you wanted with MU, you'd still be doing the same thing, really. Unless you put a copy of MU on each subdomain, and then had it create the blogs using a subdirectory install (to get, for example). Still though, would be essentially the same thing. As using WP and categories.

  10. Madoc
    Posted 15 years ago #

    lunabyte, You're great!

    Thanks. Your input is really helpful to me. Now I am convinced that I will make it with one single Wordpress(-Single) blog.

    That is, almost. I did not yet come across the way how to set up a page that shows only the posts out of a certain category. Maybe it's just there, as a standard function of WP. But since You are using the vocabulary "pull", it seems to me that there would be a little programming involved for that. Anyway, I think I can figure that out.

    One thing that still sticks is the RSS feeds. Is there a standard WP feature that allows me to get the RSS feed for a certain category only?

    Unfortunately, on the week-end, my time for doing experiments with WP was a little short. I tried the approach to mark the posts for the different blogs by using meta fields. To test things, I modified "get_posts" in "wp-includes/post.php" of WP 2.1.1. I tried to enforce the "meta_key" and "meta_value" arguments, just to test if this would filter out the posts I want for a certain blog.

    It didn't work. Probably I just was on the wrong track. But I found it hard to figure out which PHP function is called when. (Really; I am a Java programmer. In Java, it is not so hard to tell which part of the program does what. But with PHP - pfff. You really need to know the project's code by heart.)

    I will keep on trying out, also regarding Your remarks and ideas.

  11. lunabyte
    Posted 15 years ago #

    You'll have to trick out your templates pretty good, but that's it.

    No meta keys, no need to hack the core files at all.

    Off a clean install, all you will need to modify is the theme templates.

    Combined with a stristr ( is_category() won't work, as you may be in a sub cat of that) for the category, you can modify the sidebar to do something like:

    if ( stristr($_SERVER['REQUEST_URI'], '/personal/') ) {
       all the relevant sidebar code for "personal blog"

    then elseif's for the other "blogs", and a final else (if all else fails kinda deal) { show this sidebar content }.

    If you're modifying core files, stop. There isn't a need, and it will only further to muck stuff up.

    It's all category driven, that's it.

    You can set conditions inside the loop, for "if" it's a certain category, etc. There's lots of examples on the codex as well.

    For things like listing the categories, which would actually be sub categories of the main "personal" blog cat, you would use something like wp_list_cats, and then pass the category to get to that (including children).

About this Topic