Website security is the topmost responsibility of every website owner and visitor. You want to look for a route with no malicious users and bad bots to avoid attackers can attack your website with spam or extract sensitive information. Hence, you need a solution to this problem that is to block IP addresses in WordPress or block a website.
Hence, if the website gets hacked, they can use delicate information to execute harmful activities such as sending spam emails, stealing essential and sensitive information, or storing illegal files on your website.
If luck is not on your side, your website will further get blacklisted from Google, and your website will get suspended by the hosting provider. That’s where WordPress security services can benefit you by preventing the malicious activities in your website.
Therefore, in this article, we help you take a safe route to prevent this calamity from happening. We will help you to learn how to block a website.
Reasons for Blocking IP Address
The visitor of your web page accesses your page via a device that has an IP address. You can block the user whose intention is not pure to access your website if you know about their IP address.
Besides, there are two kinds of damages that visitors can cause to the website. Those are the following:
- Firstly, leave spam comments on your website.
- Secondly, someone tries to hack your website.
1. Spam Comments
Spam comments are extraneous comments usually posited by bots. The comments contain advertisements regarding selling illegal drugs or linking to any other website that chases away your website traffic.
WordPress has a feature that allows you to manually approve the comments before they get published on your website.
However, moderating comments are a time-costing and dull task; hence, you should find the suspicious IP addresses and block them or you can block a whole website.
2. Block Hack Attempt
Hackers are always looking for the window to attack websites. Hence, the most common kind of hack attack on WordPress sites is known as cross-site scripting.
Cross-site scripting, also known as XSS, is a web security vulnerability that allows hackers to accommodate visitors’ association with a vulnerable application. It enables the hacker to avoid the same-origin policy designed to separate various sites from one another.
Therefore, in this kind of attack, the comments section is utilized to attack your site or excerpt delicate information from your visitors.
Comments are a crucial part of your website, and the website owner can’t retire them. Thus, the best choice here is to block malicious IP addresses in WordPress is the perfect solution. If you still think it’s difficult to block a website then you can consult with a professional.
How to Locate a Suspicious IP Address?
To find the IP address of a spam commentator is not an easy task to do. So, to locate the shady IP address, you have to follow the following steps.
1. Go the Admin Dashboard of your WordPress account >> locate the Comments from there.
After clicking on it now you’ll see:
So, you need to check the website’s access logs for a brute force attack or DDoS attack.
You can find the access logs in the cPanel of your web hosting account.
Hence, to locate the access logs, you have to log in to the cPanel of your web hosting account and find a Metrics section under which you will discover Raw Access.
The access log document every visit to the website. You can see the access logs via the notepad application on your PCs.
You can confirm the IP addresses that are suspicious with the help of the blacklist check tool.
Moreover, several website owners opt to blacklist all the IP addresses ranges from a particular country. It is a solid pick if you have a specific target audience.
How to Block IP Address to Not to Access Your Website
There are malicious IP addresses from whom you have a threat, and you have to block them to prevent them from accessing your website.
1. Block IP Address Using Plugins
We need software that continually monitors access to the site and all by itself blocks the dubious IP address. This method is preferable if you want a continuous check on the IP addresses that access your website and not look to block any individual IP address.
Therefore, in WordPress, you can use the plugins for this purpose that is Sucuri.
The Sucuri plugin is the one we use to identify any suspicious websites that try to access your website and automatically block them. It is a security plugin that complements your existing security.
Moreover, it also checks the website for malware and checks file integrity. Besides, the premium version comes with a website firewall, and the firewall supervises your website for DDoS and brute force attacks.
The Blocker plugin comes with an IP whitelist, blacklist, country-specific IP blacklist features. Moreover, it obstructs malicious bots or user agents.
It cost about $40.
4. Cloudflare Manager
The Cloudflare Manager plugin integrates the site with the Cloudflare firewall. Moreover, it offers features to whitelist, blacklist IPs, and block specific country IP addresses.
5. IP2Location Country Blocker
IP2Location is a plugin that allows you to block undesirable traffic from accessing the blog posts or admin by proxy servers.
Besides, you can whitelist the crawlers, for example, Google or Bing.
6. Block IP Address via .htaccess file
Another method to block your website is not to accept the IP address from the .htaccess file.
The .htaccess file is a hidden file that resides in the root directory of the website.
Therefore, to access the .htaccess file, you log in to the cPanel and open the File Manager.
You have to tick the Show Hidden Files option to view the .htaccess file.
Now, open the file and include the blocking snippet to it.
Whereas ZZZ.ZZZ.ZZZ.ZZZ is the IP address you want to block from your website to access it.
7. Block IP Address from cPanel
Several times you will face the situation where you are required to block the IP address. It could be due to someone trying to access your WordPress admin section or an awful bot.
Thus, cPanel allows you to block the IPs.
Given below are the steps to block the particular IP address or IP address range.
1. Login to cPanel by entering the credentials.
2. Locate IP blocker in the security section.
3. Now, here, enter the IP address you want to block. Then click on Add.
Besides, you can write in the following pattern as shown.
Hence, the IP address you added will not be able to access your website.
We hope this guide helped you learn how to block a website. You can block the IP addresses in the WordPress website by following the above.