You can use the .htninja optional script: https://blog.nintechnet.com/ninjafirewall-wp-edition-the-htninja-configuration-file/
<?php
/*
+===========================================================================================+
| NinjaFirewall optional configuration file |
| |
| See: https://blog.nintechnet.com/ninjafirewall-wp-edition-the-htninja-configuration-file/ |
+===========================================================================================+
*/
$ip_array = ['23.88.6.90' , '136.243.103.55' , '176.9.77.187', '5.161.48.189'];
if ( in_array( $_SERVER["REMOTE_ADDR"], $ip_array ) ) {
define('NFW_UWL', true);
return 'ALLOW'; // whitelist
}
Thanks for the quick response and help!
Just to make sure I understand correctly, because currently the file named “.htaccess.ninja1731118484” is practically a copy of the contents of the original htaccess file.
Should I copy this php snippet to the top of the file and leave everything else in there, or is there some other method?
The file name is .htninja
, not .htaccess
. The .htaccess.ninja1731118484
you see is a backup of your original .htaccess
. If your site works as expected, you can delete that backup file.
The .htninja
file is a PHP file. Just paste the above code into it.