December 29, 2014

WordPress 2 multi-blogging made easy

I upgraded the site to WordPress 2 this morning. This wouldn’t be a bit deal, since the dev team has made it so easy to upgrade. What makes it interesting is that I read a tip on the WordPress forums and came up with a simple method to enable multiple domains using one blog installation on Linux/BSD systems.

1) Get WordPress 2.0 and unpack it to a master directory you’ll be symlinking later.

2) Copy wp-config.php to wp-config-orig.php.
3) edit wp-config.php, replacing the whole thing with:
<?php include($_SERVER['DOCUMENT_ROOT'] . '/config.php'); ?>
4) make the directory for your domain, for example:
mkdir coderseye.com
5) cd into the directory and symlink the contents of your master directory.
cd coderseye.com
ln -s /home/example/wordpress-master/* .

6) copy the original wordpress config file, naming it “config.php” and edit like you usually would for wp-config.
cp /home/example/wordpress-master/wp-config-orig.php config.php
7) Done! You’ve successfully linked another directory as a separate blog with the same base files.

Making it automatic

I’ve made a script which automates all of this, at least on Linux boxes. You just call it like so:
setup_multiblog.sh master slave
If “slave” directory exists, it will be backed up, and upgraded to work with the master as a slave-multi-blog.
If it doesn’t exist, it will be upgraded.
If the master doesn’t have the modifications I describe in step #3, the script will back up wp-config and make the modifications.

setup_multiblog.zip

Enjoy, let me know if it needs tweaks, it has a lot of self-checks built in, so hopefully it won’t trash anything. I’d backup first, just to be double-sure.

Technorati Tags: , , ,

Share and Enjoy:
  • services sprite Wordpress 2 multi blogging made easy
  • services sprite Wordpress 2 multi blogging made easy
  • services sprite Wordpress 2 multi blogging made easy
  • services sprite Wordpress 2 multi blogging made easy
  • services sprite Wordpress 2 multi blogging made easy
  • services sprite Wordpress 2 multi blogging made easy
  • services sprite Wordpress 2 multi blogging made easy
  • services sprite Wordpress 2 multi blogging made easy

No related posts.

About Bruce Kroeze

Comments

  1. Derek says:

    What about caching in wordpress, does anything need to be modified to make that work properly? thanks in advance, Derek.

  2. Bruce says:

    Nope, it works fine with no modifications. This blog runs under the exact scheme I describe in this article, alongside 3 other blogs.

  3. Ashley Aitken says:

    I’m having problems with this great “fix” for multi-blogging. If I try to give each blog a different theme then everything goes haywire. All the blogs become one (the first one used). I think it has to do with the caching in the wp-content directory. If I trash that then one blog will work again properly but all the others will become that blog.

    I’m guessing that this “fix” will only work if all the blogs share the default theme? I did play around with the permissions of the WP and other directories so it may be that, but I have tried reinstalling and it didn’t fix things.

    Has anyone else seen this problem?

    Thanks,
    Ashley.

  4. Bruce says:

    I definitely use different themes for different blogs. I just now verified how I’ve got things set up.

    I do a slight modification of my original technique, where instead of symlinking wp-content directly, I make that a real directory and then symlink most of the directories under it.

    Notably, I do not symlink the cache directory. I make that a real directory.

    I’ll make a new post about my technique and create an updated script this weekend.

  5. Ashley Aitken says:

    Thanks for the quick response.

    I think that is the way to go.

    I think my problem is not the multiple themes but multiple domains (just guessing).

    I will do the linking thing as you suggest, it is a pity the cache directory isn’t “relocatable” like the config.php file.

    Then we could put the cache in each separate blog more easily.

    Thanks again.

    Cheers,
    Ashley.

  6. Ashley Aitken says:

    Just one other thing: you must symlink all the files in the WordPress directory as well, I guess.

    This is almost like having a separate install for each user (which probably isn’t that much trouble anyway).

    Perhaps that is what you have.

    As you say, we could still share (symlink) the plugins and themes folders so they don’t need to be duplicated.

    Cheers,
    Ashley.

    PS We only have 5 or 6 blogs, not like 100s.

  7. Ashley Aitken says:

    Think I solved it. Moved to 2.0.4 (from 2.0.0) caching off, so now I can have a shared “WordPress” folder with all source and plugins. No problems.

    Cheers,
    Ashley.

    PS It’s unfortunate that WordPress is not factored to allow easy reuse of installations. Just having a separate read-only code folder from the wp-content would do most of the trick.

  8. Joe says:

    This might be a retarded question……….but what can I say, I’m retarded.

    How the heck do I run that setup_multiblo.sh script?

    I log into SSH via Putty, but I can’t for the life of me figure out to call the script.

    And I spent over an hour searching Google and Newsgroups, but I can’t figure it out.

  9. Joe says:

    Hi Bruce,

    I’ll Paypal you $50 if you successfully help me setup the implementation you blogged about in this posting.

    I know it’s not much, but that’s about all I afford right now.

    Please email me at the email address attached to this comment.

    My situation is that I am on a Shared Dreamhost Server account.

    1. I mapped my domain to go to a subfolder (new install).

    2. I SSH’d in and followed step-by-step your process. The only hangup I had was that Putty wouldn’t let me call verbatim the following line to set the Symlink up:

    ln -s /home/myusername/MainDirectory/SubDirectory/*
    (it didn’t like the asterisk at the end)

    I did manage to do the following:
    ln -s /home/myusername/MainDirectory/SubDirectory/

    I FTPd in and verified the Symlink was there.

    3. I installed a new config file in (Original WordPress wp-config).

    4. In the Main folder I erased everything else in wp-config, and just put that line you specified above

    And that’s where I’m at right now. My domain name is resolving to a 404 Cannot find on server page.

    Please help as soon as you can!

  10. eregilkibly says:

    Qual e` il Viagra? Come funziona il Viagra? Se volete sapere di informazioni sulla disfunzione erettile trattamento medicina allora il Viagra e` la scelta giusta per voi. acquistare cialis on line

  11. Hi webmaster!

  12. yamaikaaa says:

    Hi to everyone !!! Penny Hardaway’s comeback to Maimi Heat, what do you think ?
    %0D%0AA bikini or two-piece is a type of women’s swimsuit, characterized by two separate parts

  13. R. Lahuerta says:

    Thans a lot mate. I worked for me like a charm on WordPress 3.1.2 and was much simpler that the multisite installation.

Trackbacks

  1. [...] The only thing left was to setup wordpress to work for multiple blogs so I didnt have to maintain and backup a new install for every subdomain I setup.  The biggest help I found was this article on coderseye.comwhich outlines how to get wordpress working with multiple config files. My method is basically the same as his with a slightly different config file to account for the subdomains. [...]

  2. [...] The only thing left was to setup wordpress to work for multiple blogs so I didnt have to maintain and backup a new install for every subdomain I setup.  The biggest help I found was this article on coderseye.comwhich outlines how to get wordpress working with multiple config files. My method is basically the same as his with a slightly different config file to account for the subdomains. [...]

  3. [...] One of the first post on this site was Multi-blogging made easy. It is a common desire, to set up WordPress for multiple separate blogs with only one master install. That way updating the blog is much simpler, with files only in one place. [...]

  4. [...] Hier habe ich eine gute und vor allem kurze Anleitung gefunden, wie man ganz "easy" mit mehreren Blogs auf einem Server nur eine Installation von WordPress benötigt.Für alle Update-Stressgeplagten Admins:Wordpress 2 multi-blogging made easy [Tags:multi blog, Projekte & HowTos, update stress wordpress 2] ähnliche Beiträge: [...]

Speak Your Mind

*