If you wish to block specific IP addresses from accessing your WordPress website, this article will help you.
Why Block IP Addresses?
This helps to block spam and hacking attacks on your website. When you block an IP address from accessing your website, it prevents DDOS (denial of service) attacks, email spam attacks, comment spamming, hacking attempts, and unwanted visitors.
A DDOS attack is very harmful for website. It makes your website become inaccessible frequent. Sometimes, your pages may even take forever to load.
How to Find Out IP Addresses to Block in WordPress?
IP addresses are stored by WordPress for users who comment. These IP addresses can be seen by visiting the comments page in the WordPress admin area. In case, you suspect your website under DDOS attack, simply locate the IP addresses by checking the access log of your server.
Login to the cPanel dashboard of WordPress hosting account to see the logs. Locate the ‘logs’ section. Click on the icon ‘Raw Access Logs’.
The icon will take you to the ‘access logs’ page. In order to download the access logs file, simply click on your domain name.
The access log file will be safe within a .gz archive file. Click on it and extract the file. Inside the archive, you can see the access log file than can be opened in a plain text editor such as TextEdit and Notepad. This access log file comprises of raw data of all requests that were made to your website. Remember that each line starts with the IP address making request. Now copy a suspicious looking IP address. If you need assist then feel free to ask us: wpwebsitemaintenanceservices.com
After locating those IP addresses, copy and paste them in a separate text file.
If you want to stop users with certain IP address from commenting on your site, simply do that in the WordPress admin area.
Step 1: Go to Settings » Discussion page.
Step 2: Now scroll down to ‘Comment Blacklist’ text box.
Step 3: Copy and paste the IP addresses that you wish to block.
Step 4: Now click on the button ‘save changes’.
Now WordPress will block users with the IP addresses. They won’t be able to leave comments on your website. They can visit your website but cannot submit a comment. They will see an error message if they try to.
How to Block an IP Address Using cPanel?
This process totally blocks, an IP address from viewing or accessing your website. So if you wish to prevent your WordPress site DDOS attacks and hacking attempts, use this method.
Step 1: Login to cPanel dashboard of your hosting account.
Step 2: Scroll down to the security section.
Step 3: Click on ‘IP Address Deny Manager’ icon.
Step 4: You will be taken to the IP Address Deny Manager tool. Here, add the IP address (s) you wish to block.
The technique works only when you block only some of the hacking attempts, users from a country/region or certain basic hacking attempts.
For several thousands of hacking attempts and attacks are made through a huge variety of random IP addresses all over the world, it isn’t possible to keep tabs on all of those addresses. Here, you can choose a Web Application Firewall (WAF).
Hope this article helped you learn an easy way to block IP addresses in WordPress. =====================================================================