From time to time I’ve come across an issue where the Settings >> Permalinks Page is completely blank. This sometimes seems to occur after settings have (incorrectly) been applied, or a site has been migrated to a new host, but I have also seen it on clean installations.
The problem appears to be related to the way that WordPress determines whether mod_rewrite is enabled within the hosting environment, and the fix involves “tricking” WordPress into believing that mod_rewrite is actually installed. (note: if it isn’t running, you’ll not be able to change the permalinks anyway).
The solution
The fix involves modifying the got_mod_rewrite function in the wp-admin/includes/misc.php file as outlined below.
note: before editing any core WordPress system files, you should be taking backups (even if you think you know what you re doing) – and also be aware that WordPress upgrades may overwrite any changes that you make.
function got_mod_rewrite() {
//$got_rewrite = apache_mod_loaded('mod_rewrite', true); //old line with false negative;
$got_rewrite = true;//force the response to true as we know mod_rewrite is installed;
return apply_filters('got_rewrite', $got_rewrite);
}
The Explanation
In this function the apache_mod_loaded('mod_rewrite', true)
conditional statement checks to see if “the mod_rewrite apache module is currently loaded then rewrite option is true”. The fix ($got_rewrite = true;
) forces this test to be true.
The Permalinks Settings page will not be displayed properly (i.e. it is blank) if either php is unable to detect that the mod_rewrite module is loaded or the client site/server system is performing the rewrite through an alternate means (not the mod_rewrite module). It is also possible that the client site/server system is unable to rewrite because the module not properly configured or loaded in the first place.