Rebuild, Rewrite, Redirect

If you follow me on Twitter, you may have heard me growling a bit over the last week or so about @#$%! SEO blackhats and their @#$%! pharmahack.

Suffice it to say, I’d been gotten, and gotten so well that while I could find evidence they’d been there, I couldn’t find the script that was actually doing the damage.

Happily I had a solid backup that predated the hack, and happily, I guess, I hadn’t exactly been active around here since. So how did I handle the problem?

1. Wipe everything. Files, databases, everything.
2. Begin with a fresh installation of WordPress, a brand new database, and a new MySQL user.
3. Gradually rebuild the site.
4. Import tables one by one into the new database.
5. Tinker.

Unfortunately, I’m stuck in that last step. Here’s the problem: I’ve been running multiple sites via multiple WP installs, and a weakness in any of them threatens the others. (Not to mention the work of keeping all those installations up to date.) So I’ve decided to merge as much as I can into a single multi-site instance. And I figured I’d go ahead and use a subdirectory setup, rather than treating each site as a subdomain, as everything ultimately belongs under the umbrella of

But! Because it can’t be that easy! WordPress 3.x, when set up as a subdirectory-based multisite installation, adds the slug “/blog/” to all of the permalinks of the main site. Which would of course be this site. Which means that all of my internal links are now broken, and any inbound links are broken as well.

I’m fighting with mod_rewrite right now, and while I’m hoping to find a better long-term solution than this, for the moment, if you’re looking for something in particular, you may want to scroll to the bottom of the page and search for it.

And if you’re smarter about mod_rewrite than I am (which really, really wouldn’t take much), let me know.


  1. Apparently being smarter about MySQL than about mod_rewrite, I’ve managed to replace most of my permalinks with working ones. That doesn’t do inbound links any good, of course. Will keep tinkering.

    1. You are braver than I am! Last week I was about to convert my regular WP install into a multisite, and then I realized what a pain it’d be to rework all the links and permalinks. I ended up keeping the single WP site for my main blog and adding a separate multisite installation into a subdirectory. That’s two blogs to administrate, but the mod_rewrite work was too daunting for me to tackle in the time I had set aside for it.

      BTW—I love the new theme! Very clean and readable!

  2. Love the redesign of the site — looks super! Clean (as Mark says) and elegant.

    Wish I understood WordPress enough to help, but… I know just barely enough to maintain my own (considerably less ambitious) blog. Whenever something goes awry on my blog, I struggle to set it right. So… I can offer only sympathy. Which, I realize, doesn’t help you solve the problem. Um,… did I mention that the redesign looks really nice?

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.