Blocking access to your WordPress admin area is a great way to improve the security of your WordPress site. It also helps reduce the load from brute force attempts that slow down your website load time. All you need to to enable this feature it paste some text by editing the .htaccess file.
To block access to your WordPress admin portal, you need to add the following to your .htaccess file:
<Files wp-login.php># set up rule orderorder deny,allow# default denydeny from all# Thexyz Office Rangesallow from 10.10.4.0/23allow from 10.20.4.0/22allow from 10.20.7.0/24allow from 10.30.4.0/2allow from 10.30.2.0/24allow from 10.30.104.0/24# Add additional IPs for access here</Files>
You just need to change the numbers in red to your own IP.
You can find your IP address here.
To further secure your WordPress site, take a look at the complete list of .htaccess snippets to improve WordPress security.