WordPress troubles with .htaccess & 500 errors

Update РThanks to @retlehs pointing out, this issue is with an old version of Roots and HTML5 Boilerplate htaccess has now been moved to a plugin.

I recently had an issue with a client’s site that I’d inherited. It was a WordPress (up-to-date) and was running a theme based on Roots. I’ve used Roots a few times before and it’s always been rock solid, although due to the amount of stuff it does straight out of the box, sometimes these functions can cause errors.

The site in question was creating a 500 Internal Server error which would go away when the .htaccess file was replaced with a default one. This would be fine until the Dashboard was accessed, where upon the 500 error would appear again. Turns out Roots was set to inject the HTML5 boilerplate .htaccess content into the .htaccess file. This ordinarily isn’t a problem (it does a load of useful stuff) but in this case, the hosting environment didn’t allow this function and therefore was creating the error.

The fix was simple. Go to /themes/roots/inc/roots-htaccess.php and comment out the following line.

add_filter('mod_rewrite_rules', 'roots_add_h5bp_htaccess');


//add_filter('mod_rewrite_rules', 'roots_add_h5bp_htaccess');

Once you’ve changed that and uploaded the change, replace your .htaccess file with a standard one and you should be fine.