Do you receive unwanted replies and spam from your website visitors? Have you noticed a delay in your website load time? If yes, it may mean that some users are trying to gain unauthorized access for illegal purposes. This can be a cause for concern as the safety of your website is your top priority. However, there is also a solution – to block IP addresses. Learn how to get rid of intruders, block spam addresses, and improve the security of your website below.
Reasons for Blocking IP Address
WordPress records all IPs that enter your site in access log files. Such addresses help identify visitors and their activities. The first reason to block an address is to stop a hacking attempt by hackers. You also need to block the IP that tries to launch the DDoS attacks on your site. The attack occurs when your website becomes unavailable or the page load time increases. In this case, it is extremely important to identify dangerous addresses and block them.
Ways to Block IP addresses
The easiest way is to use specialized software installed from here and block spam IP. Depending on the type of attack, you can also take the following steps.
1) Use the WordPress Admin Panel
First, go to the replies section via the Admin Panel. All users who have commented on your articles will be visible. The IP will be right under the user’s profile. Copy the address of the user who posted the spam comment and block it in the “Comments Blacklist” section.
2) Use the IP Blocker on Your Hosting Control Panel
Go to the “Access Restriction” section of your control panel. Indicate the address you wish to block in the text box. You can enter the whole range of addresses that you need to block. These IPs will no longer be able to get on your site.
3) Block IPs via .htaccess Directives
Log in your site’s control panel, select “files” and press the “file manager.” Htaccess and other files can be hidden in the root folder by default. To view this file, press the “Settings” icon in the upper right corner of the screen. Select the “Show dotfiles” checkbox, and press to save the changes. Then, find and select .htaccess and press on the “Change” icon. Add the following rule:
- order allow, deny
- deny from 220.127.116.11
- allow from all
Press on the “Save Changes” icon.
The above steps will only block one address. Whether you wish to exclude other spam IPs, simply add them to the new lines.
The task of blocking an individual or range of IPs can be tedious. Security plugins can help you track suspicious IP addresses and block them without your participation. Anyway, whether you wish your website to work in the right way, take care of the security and ensure that no spam replies will bypass it.