Making WordPress 2.0 Permalink Rewrite Rules Work
02 Jun 2006I work for a web hosting company, and we're currently monkeying around with an installer for WordPress. In testing it, I fully expected custom permalink rules to break--I'd heard rumblings from looking through our support queues that it might not work. Sure enough, custom permalink rewrite rules did not work.
WordPress 2.0 does some nifty stuff with rewrite rules. Rather than do what older versions did and generate a big .htaccess file with 50-odd lines, it instead generates a compact, sub-10 line .htaccess file. These rules basically let WordPress handle all of the rewrites internally. In many cases, this is a cool thing (it's what I use here on my blog). However, it's not universally compatible--a quick search on Google shows a bunch of people running into a problem with this new system.
I dug around for a bit, trying to find a solution for our customers. And I found one. In the wp-includes/classes.php file, there's a variable called use_verbose_rules. By default, it is set to false, which triggers WordPress to use the new, compact rules. Setting it to true causes WordPress to generate the old-style big .htaccess file. Sure enough, as these are pretty normal, generic rewrite rules, *everything* *just* *works*.
I'm sure I'm not the first person to stumble upon the solution, but since I didn't find it mentioned anywhere before, I thought I'd share it. Plus, my memory isn't what it used to be, so this'll be helpful in making sure I don't forget how to fix this, should the need arise again.