Skip to content

Instantly share code, notes, and snippets.

@priscillamc
Last active December 16, 2019 09:21
Show Gist options
  • Save priscillamc/17690153aac3cdfd04f79b35657d2908 to your computer and use it in GitHub Desktop.
Save priscillamc/17690153aac3cdfd04f79b35657d2908 to your computer and use it in GitHub Desktop.
Fixes

iThemes Security Banned Users Apache Fix

Enables custom IP and Basic Auth restrictions with iThemes Banned Users module enabled.

The 'Require all granted' directive gives access to any host not banned in the list, ignoring any other restrictions in the .htaccess file. This results in basic authentication and other rules not working.

/**
* Enables custom IP and Basic Auth restrictions with iThemes Banned Users module enabled
*/
function pm_fix_ithemes_apache_config( $modification ){
$modification = str_replace( "\t\t\tRequire all granted\n", '', $modification );
return $modification;
}
add_filter('itsec_filter_apache_server_config_modification', 'pm_fix_ithemes_apache_config', 11);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment