How to Block IP Addresses in WordPress

security, protection, anti virus

WordPress website security is the top main factor for every user. You have been always looking for the ways to get rid of malicious users and bots, which will target your website with some spam or steal your website critical information. So this always requires you learn about how to block IP address in your WordPress website.

Best possible solution is to block the specific IP address from accessing your website or some specific feature by adding them in the Blacklist. For example you need to block a spam comments, you simply need to put that IP in blacklist that will create a red flag for that IP address and bans them from comments section.

In this article, we are going to show you how to block IP address by using blacklisting technique and benefits of using them. We will also discuss about different ways to block IP using plugins. Let’s get started.

Blacklisting Brief Introduction

Every visitor on your website has its IP address associated with them which specifies the particular internet connection and remains same for that specific user. By this way you have a close eye on every user by IP address and noticed for any suspicious activity.

Below we are going to highlight the examples of red flags that indicates the user from specific IP address is Potentially harmful:

1. Multiple repeated login attempts on your website indicates that someone is trying to hack your website.

2. Posting of spam comments from same user/specific IP address.

3. Accessing unauthorized information by unknown or role based user.

If you are facing any of these activities on your website, you can simply put them in blacklist to avoid doing any further this type of suspicious activity from that specific IP address. By doing this, it will totally block them or blocks the specific access on your website.

The alternate way to avoid this type of activity is whitelisting which is totally in contrast to blacklisting. In whitelisting, only specific IP addresses are allowed to access your website, rest all of them are blocked.

Methods for Blocking IP address

One of the method for doing this will be target based and block them from specific area on website while the other one block’s them from your entire website. Let’s have a look into these methods:

1. Block Specific IP Address Using Comments Section

The common cause for using blacklisting technique is to avoid spammers or bots posting unwanted or suspicious messages in comments section of your website. 

Each comment posted on your website has its specific IP address which is shown in comments section under each username.

If you notice multiple or spam comments from same IP address either they are posted by different username. You will be able to simply block that specific address using comments black list feature in WordPress. To do this, navigate to Settings > Discussion and scroll down to Comment Blacklist section.

Here you can simply paste that specific address that you want to block and click save changes. This will block all the users from mentioned IP’s and they unable to comment on your website.

2. Completely Ban IP Address From Your Website

By doing this way, the blocked IP address will no longer be able to access your website.

To do that, simply login to your website via FTP or CPanel to edit .htaccess file for some changes. 

Note: Please make sure to create a backup before proceeding as a safe side to prevent any loss on your website.

Here are going to show you using CPanel login.

First login to your website CPanel and navigate to File Manager under Files section.

Now open File Manager and look for .htaccess file in the root directory of your website. In order to view the .htaccess file, you have to enable show hidden files for settings section. 

After navigating the .htaccess file right click and select edit to make changes. This will open the file in your default text editor.

Now, add the following lines at the bottom of file.

Order Allow,Deny
Allow from all
Deny from 000.111.000.111

Make sure to enter the IP that you want to block in last line. Here you can add multiple IP with same line as last one. Save the file, now users from list of IP addresses will be unable to access your website.

If you don’t want to edit .htaccess file or don’t know how to edit. You can also use plugin for doing this.

All In One WP Security & Firewall

6 thoughts on “How to Block IP Addresses in WordPress”

  1. Hey there! I’ve been reading your website for a while now and finally got
    the courage to go ahead and give you a shout out from Huffman Tx!
    Just wanted to mention keep up the excellent work!
    Wow, this paragraph is fastidious, my younger sister is
    analyzing these things, so I am going to inform her. I have been browsing online more than 4
    hours today, yet I never found any interesting article like yours.
    It is pretty worth enough for me. In my opinion, if all web
    owners and bloggers made good content as you did, the internet will be much
    more useful than ever before. http://ford.com

    Feel free to visit my page; Jane

  2. This is really fascinating, You are an excessively professional blogger.
    I’ve joined your rss feed and look ahead to searching for more of your
    great post. Also, I have shared your web site in my social networks

  3. Heya i’m for the primary time here. I found this board and I in finding It truly useful
    & it helped me out a lot. I’m hoping to present one thing
    again and aid others like you helped me.

    Also visit my web-site: w88

  4. George began utilizing the net webpage advertising and marketing
    world back in January 2008 when he was 17
    and in opposition to all odds found great success
    as an affiliate marketer, making thousands. Massive improvements to
    the core from the system itself, notably market and key phrase research (now it’s means
    extremely easy before) and FTC compliance, making sure you and your sniper websites are 100% protected in your internet online affiliate marketing from
    any authorized threats. So to check this, I adopted the system step by step on find out how to rank this site for the key phrase
    ” Google Sniper Review ” That is the kind of
    phrase you’d want to focus on for any sort of niche. The course program goals to focus on beginners and mid-stage skilled
    online marketers. It’s also one of those few information products that really coach
    you on some priceless stuff many entrepreneurs utilized in order to earn money.
    If you’re here, you’re keen on making some cash on-line.

Leave a Reply

Your email address will not be published. Required fields are marked *