Category: Uncategorized

  • Migrating single site WordPress installations to a multisite network

    I have seen this question about migrating to a networked multisite WordPress install come up more than once so I thought I’d write down my experience. I used to host about 10 individual WordPress installations. Managing them and keeping them all up to date was a pain, and that meant I always had sites that were out of date. So a few months ago I spent some time migrating them all to a new WordPress network installation. That allows you to host multiple sites all in the one WordPress installation. The only problem is that its quite cumbersome to migrate sites into the new site.
    I’ve tried to document the overall process. If anything isn’t clear please let me know and I’ll and elaborate.

    1. Backup all your old sites and databases
    2. Go to each site and export the site
    3. Select a suitable main domain name for your new networked WordPress site. When you create a new blog in the network, the admin of the blog will get an email from your multi site saying it was set up, so choose something that is suitable bearing that in mind.
    4. Set up the multi site with subdomain (not sub folder).
    5. Set up apache virtual hosts to direct ALL host traffic to the wp install.
    6. Set up subdomain sites for each site you wish to import.
    7. Install the WordPress MU Domain Mapping plugin
    8. For each subdomain:
      1. Import the old blog
      2. re-delegate the domain or set your hosts file up to point the domain name to your new WordPress network.
      3. On the Info tab in your network settings for the domain, change the Domain to the actual domain you want,
      4. On settings tab, change siteurl to the blogs correct domain,
      5. Change “home” to the correct domain
      6. Check through the list and fix up any other instances of incorrect domain. Save the changes.
      7. Note down the site id (from the url. something like: http://mynewmultisite/wp-admin/network/site-settings.php?id=4  means site ID is 4)
      8. Go to Settings/Domains and in the New Domain section, enter the site ID and correct domain for the new site
      9. Click save and that’s it – the new domain should be working. Test it out.
      10. Fix up all the old links to images. they will currently be links with the old subdomian in them. You can fix them up with the most excelent Search and Replace plugin.
    9. That’s it, you should be done.

    It’s a fairly long winded process but it can be done and is worth the effort. Running a networked site instead of many individual installs saves a lot of time in upgrades and  maintenance.
    Moving across the plugins and themes is also a bit of a pain. You just have to manually do it per site. There are plugins that are supposed to help move widget settings across but I had limited success with them. “Widget Data – Setting Import/Export Plugin” seemed to add the settings not replace them so you end up with duplicates of widgets and things. it may have improved since I tried it.
    I don’t like to site wide activate plugins but WordPress does not have an option like with themes, to only enable a plugin on a per site basis. There is however a plugin for that: Multisite Plugin Manager. With that you can turn on plugins for each site in the Network Admin/Edit Site area. Then you have to go to the site’s dashboard and activate the plugin in there afterwards.
    Another useful plugin for a networked site is called “Network Plugin Auditor” it adds a column to the Network/Admin/Plugins page that shows which sites are using each plugin. It also also shows the converse on the Sites page.
    There are tools to assist this process also. One such tool that comes highly recommended, that I have not personally used is Backup Buddy. If you have more than a few sites to migrate it may well be worth investing in something like that to help you.

  • Ordered list with letters in Twenty Twelve

    UPDATE: It turns out I was wrong. type= is deprecated. The correct way to do this is style="list-style-type:lower-alpha". I updated my post to reflect that.
    It appears there is a bug in Twenty Twelve as of this writing where specifying the type of an ordered list is not respected. So you can’t get an OL of letters. The second list below should have letters.

    1. first line
    2. second line
    1. first line
    2. second line
    1. first line
    2. second line
    1. first line
    2. second line
  • A word on WordPress security

    First of all, I am not an expert on security. So please check this info for yourself, and don’t be shy to suggest improvements either.
    In order to keep your WordPress site secure, one of the things you can do is slow down a potential brute force attack, so the attacker can try fewer login/password combinations per second.
    There is an excellent plugin by convissor over at wordpress.org called Login Security Solution that does just that. I have been running it for a while now and it is very good. It emails you if your site is under attack and informs you about what its doing. It also ensures users have secure passwords. I have mentioned it before.
    Recently I have had a few attacks and encountered a minor problem with the plugin. Daniel has been extremely proactive in tracking down the issue. But during the process I found that the attacks were coming from 3 IPs.
    That made me think I should ban those IPs. And that led me to fail2ban. This is an excellent tool that monitors for failed login attempts and simply temporarily bans that IP using your firewall.
    In debian you install it with aptitude install fail2ban. If you want to enable apache monitoring, you need to add:

    [apache]
    enabled = true
    

    to /etc/fail2ban/jail.local
    restart fail2ban and that’s it. Within minutes of me activating it, it had already banned a few IP addresses due to failed ssh login attempts.

  • Lego Brick Separator

    Lego Brick Separator

    We got some Lego for my son the other day and it came with a Lego Brick Seprarator which has to be the best invention since Lego itself. It makes short work of stubborn bricks that are stuck together. As a kid I used to resort to using my teeth to separate them. This thing makes it easy.

  • .bash_profile vs .bashrc in OS X Terminal.app

    .bash_profile vs .bashrc or why does OS X ignore my .bashrc in Terminal.app?

  • Keyboard shortcut to un-minimise a window in OS X

    It’s a bit fiddly but it can be done.
    Cmd+m to the item you want to un-minimise, then while still holding cmd, press Option. Release Cmd and then finally release Option.

  • Cmd+m to Minimise a window in OS X

    Cmd+m to minimise a window in OS X

  • Insert a new heading after numbered list in org-mode

    In org-mode in emacs, M-<RET> will add either a new heading or if your insertion point is between a list item and a heading, it will add a new list item. This is not always desirable. To add a new heading try C-U M-<RET>.
    I only discovered this as I got frustrated with org-mode insisting on adding an item to the list rather than creating a new heading. The emacs way around problems like this is to prefix the command with C-U to make it do something slightly different.

  • Collaborative online $\LaTeX$ documents

    writelatex.com is awesome. Edit your $LaTeX$ document and see the changes almost immediately.