General Topics

How To Block IP Address Manually For Stop Spam?

In this article, our topic is how to block IP address manually fro stop spam? First of all, I will suggest you remove unused plugins. After that take backup of your database. Now I will suggest don’t use common plugins. Because these are not helpful. Many plugins are working to stop spamming.

Now first we will create IP block list and after that paste in wp.config or .htaccess file. IP address blocking using any plugin to stop spamming is not healthful for a website. But if you block IP address manually then it is a plus point for WordPress site regarding SEO.

What is IP blocking Before Block IP Address Manually

Do you have an idea about what is IP blocking? When we are living anywhere an address we use to introduce about our location. Like that when we connect with the internet then an address which called IP address is recognition of our PC. When we want to connect a site then the IP address told him about your PR.

When you get good page rank then people start spamming for a backlink. So then you need to block those IP address which makes bad environment. You will create a file of Spammers IP addresses and paste in your root directory.

How To Check Spammers IP Addresses Using MySQL Database?

Now the turn how to check spammers IP address using MySQL database? WordPress save comments in the database having name comments. You can find prefix_comments. table. Use the below query to find out. You can also see in below pic.

  • Login your CPanel account.
  • Find PhpMyAdmin.

PHPMyAdmin(CPanel)

Select Database

Select wp-comment

Run Query

FROM
`wp_comments`
WHERE
 `comment_approved` = 'spam';

Now you will get a list of IP addresses. Just go on this site (http://www.senderbase.org/lookup/) and check the reputation of these IP’s. By typing IP address in the search bar. Want to read How to get IP address from URL?

How To Add IP Address In wp.config File?

Just see how to add IP address in wp.config file? Prepare like as below example using Notepad or Notepad ++. Paste this code after <security> and before <ipsecurity>

<add ipAddress="107.6.159.30" allowed="false" />
<add ipAddress="108.163.221.85" allowed="false" />
<add ipAddress="108.163.247.19" allowed="false" />
<add ipAddress="108.163.248.68" allowed="false" />
<add ipAddress="108.163.248.70" allowed="false" />
<add ipAddress="108.177.194.114" allowed="false" />
<add ipAddress="108.178.5.100" allowed="false" />

When we will use in the place of true it will permit to visit my site. Now access wp.config file like shown below.

  • Login your CPanel account.
  • Search File Manager and click Go.

File Manager CPanel

  • Select public_html.

Public HTML folder

Here you will find like shown as under:

wp.config File

How To Block IP Address Manually Using Apache mod_rewrite?

Now we discuss how to block IP address using Apache mod_rewrite? This method called apache moe_rewrite.

 <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REMOTE_ADDR} ^107\.6\.159\.30 [OR] RewriteCond %{REMOTE_ADDR} ^108\.163\.221\.85 [OR] RewriteCond %{REMOTE_ADDR} ^108\.163\.247\.19 [OR] RewriteRule ^(.*)$ - [F,L] </IfModule>

If you know how to access .htaccess file then good. Otherwise, you can see procedure I have also written an article about it. Don’t forget to follow us on Twitter.

Supporting Articles

Succeed With CPanel Fix File Permissions In 10 Minutes

The A – Z Guide Of Add Google AdSense To Website

Open Source Software Definition And List

Show More

Muhammad Awais Azeem

"Global Blurb since 2015" M. Awais Azeem is the CEO and founder of Global Blurb. The blog designed to share ideas about different topics. My profession is Accountant and I have completed CA Inter from Institute of Chartered Accountants of Pakistan. Me and my time present to sort out any issue regarding SEO, Blogging, Content Marketing and WordPress. Hire Us and Goodbye difficulty.

Related Articles

Want to contribute