{"id":18777,"date":"2021-01-16T15:00:06","date_gmt":"2021-01-16T14:00:06","guid":{"rendered":"https:\/\/qodeinteractive.com\/magazine\/?p=18777"},"modified":"2021-01-15T19:02:12","modified_gmt":"2021-01-15T18:02:12","slug":"wordpress-block-ip-address","status":"publish","type":"post","link":"https:\/\/qodeinteractive.com\/magazine\/wordpress-block-ip-address\/","title":{"rendered":"How to Block Certain IP Addresses on Your Website"},"content":{"rendered":"<div class=\"wpb-content-wrapper\"><p>[vc_row][vc_column][vc_column_text]Website security is one of the most important aspects of running a successful WordPress website. To defend your site from potentially harmful users, you will need to use different means of protection. Those include certain hosting features, plugins, custom code, and more. In this article, we will be taking a closer look at one of those features, namely how to block an IP address on your WordPress website. We will discuss the reasons why it might be needed and how to implement it. To make it easier to tackle this topic, we\u2019ve broken it down into several smaller steps:<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;22px&#8221;]<ul class=\"qodef-unordered-list-item qodef-toc\">\n    <li>\n\t        <div class=\"qodef-ul-title-holder\">\n            <span class=\"qodef-ul-title-content\"><a href=\"#what-is-ip-address\">What is an IP address?<\/a><\/span>        <\/div>\n            <\/li>\n<\/ul>[vc_empty_space height=&#8221;5px&#8221;]<ul class=\"qodef-unordered-list-item qodef-toc\">\n    <li>\n\t        <div class=\"qodef-ul-title-holder\">\n            <span class=\"qodef-ul-title-content\"><a href=\"#reasons-for-blocking-ip-address\">Reasons for blocking an IP address<\/a><\/span>        <\/div>\n            <\/li>\n<\/ul>[vc_empty_space height=&#8221;5px&#8221;]<ul class=\"qodef-unordered-list-item qodef-toc\">\n    <li>\n\t        <div class=\"qodef-ul-title-holder\">\n            <span class=\"qodef-ul-title-content\"><a href=\"#what-ip-addresses-you-need-to-block\">Figuring out what IP addresses you need to block<\/a><\/span>        <\/div>\n            <\/li>\n<\/ul>[vc_empty_space height=&#8221;5px&#8221;]<ul class=\"qodef-unordered-list-item qodef-toc\">\n    <li>\n\t        <div class=\"qodef-ul-title-holder\">\n            <span class=\"qodef-ul-title-content\"><a href=\"#ways-of-blocking-ip-address\">Ways of blocking an IP address<\/a><\/span>        <\/div>\n            <\/li>\n<\/ul>[vc_empty_space height=&#8221;5px&#8221;]<ul class=\"qodef-unordered-list-item qodef-toc\">\n    <li>\n\t        <div class=\"qodef-ul-title-holder\">\n            <span class=\"qodef-ul-title-content\"><a href=\"#additional-tips\">Additional tips<\/a><\/span>        <\/div>\n            <\/li>\n<\/ul>[vc_empty_space height=&#8221;80px&#8221;][vc_widget_sidebar sidebar_id=&#8221;new-top-picks-banner&#8221;][vc_empty_space height=&#8221;81px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h2 class=\"qodef-h4\">Why and when you should block certain IP addresses on your website<\/h2>\n<p>[\/vc_column_text][vc_column_text]Before we dive into the methods you can use to block IP addresses, we want to clarify what an IP address is and why you might need to block one or more of them.<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;72px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h3 class=\"qodef-h5\"><a id=\"what-is-ip-address\"><\/a>What is an IP address?<\/h3>\n<p>[\/vc_column_text][vc_column_text]An IP address (Internet Protocol address) is a <strong>unique identifier assigned to any computer connected to a network<\/strong>. It serves to tell the servers where the data should be delivered, and in that sense, fulfills the same role as an email address. <strong>Currently, two internet protocols are in use\u2014IPv4 and IPv6.<\/strong>[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]<strong>An IPv4 address <\/strong>is, most often, represented in a dot-decimal notation. So, it looks like XXX.XXX.XXX.XXX, where each of the blocks (XXX) represents a number between 0 and 255.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]On the other hand, <strong>an IPv6 address<\/strong> is represented in a hexadecimal notation. It has eight groups of four hexadecimal digits, separated with a colon(:). However, the full address is often shortened using various techniques.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]Currently, the predominantly used protocol is IPv4 although there is a gradual shift toward IPv6. The reason for this is the scarcity of IPv4 addresses. This protocol was designed decades ago and at that time the assumption was that 4+ billion unique addresses would cover the world\u2019s needs. However, it soon became obvious that the growing numbers of internet users and various computing devices will exceed the available address space. So, a new protocol, IPv6, was introduced that supports trillions (more precisely, 2<sup>128<\/sup>) of unique addresses.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]However, the two protocols aren\u2019t compatible for direct communication, so a gradual transition aided by various mechanisms is ongoing. Given that IPv4 is still the most common type of protocol, we will focus on examples that use it. However, the same principles can be applied to IPv6 addresses, in case you are using them.<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;72px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h3 class=\"qodef-h5\"><a id=\"reasons-for-blocking-ip-address\"><\/a>Reasons for blocking an IP address<\/h3>\n<p>[\/vc_column_text][vc_column_text]There are several reasons why you might want to block some IP addresses. The two most common reasons are eliminating spam or dealing with hacking threats using IP blocking.<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]Spamming is a very frequent issue every webmaster must deal with. It is particularly common in the form of comment and email spam. Even though there are quite a few suggestions on how to deal with spam (including using anti-spam plugins like Akismet), blocking IP addresses or spamming bots is quite useful as well. This lets you spare the server resources that would have been wasted on saving spam comments or messages in your database.<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]Moreover, blocking an IP address is a great way to defend against potentially malicious user activities like brute force or DDOS attacks. Examples of situations when you might be under such attacks include an increased amount of login attempts or requests for sensitive information on your website coming from the same IP address. The symptoms of these attacks are extremely slow-loading pages or your site often not being able to load. If you notice that\u2019s the case with you, then blocking the traffic from malicious IP addresses to your WordPress site is the best course of action.<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;68px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h2 class=\"qodef-h4\">How to block certain IP addresses on your website<\/h2>\n<p>[\/vc_column_text][vc_column_text]With that being said, let us explain how you can block certain IP addresses. We will also discuss possible ways of pinpointing suspicious IP addresses, as well as some precautions you should take to enhance the security of your website.<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;72px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h3 class=\"qodef-h5\"><a id=\"what-ip-addresses-you-need-to-block\"><\/a>Figuring out what IP addresses you need to block<\/h3>\n<p>[\/vc_column_text][vc_column_text]There are two common ways of figuring out potentially malicious IPs that present the risks we mentioned above. Those ways are\u2014investigating the IPs of all commenters and investigating all IPs within an access log.<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;22px&#8221;]<ul class=\"qodef-unordered-list-item qodef-toc\">\n    <li>\n\t        <div class=\"qodef-ul-title-holder\">\n            <span class=\"qodef-ul-title-content\"><strong>Commenter IPs<\/strong><\/span>        <\/div>\n            <\/li>\n<\/ul>[vc_empty_space height=&#8221;28px&#8221;][vc_column_text]WordPress notes the IP addresses of every commenter. If you wish to see the IP addresses of all who commented on your posts, you need to <strong>navigate to the <em>Comments<\/em> section within your admin dashboard<\/strong>. Then, <strong>you should examine the author column<\/strong> where the IP address is located for every comment author. <strong>The address will be located at the end, after the author&#8217;s name, and e-mail address.<\/strong>[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"969\" height=\"518\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Comments-IP-Address.jpg\" class=\"attachment-full size-full\" alt=\"Comments IP Address\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Comments-IP-Address.jpg 969w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Comments-IP-Address-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Comments-IP-Address-768x411.jpg 768w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Comments-IP-Address-620x331.jpg 620w\" sizes=\"auto, (max-width: 969px) 100vw, 969px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]Make sure to examine the content of the comments as well. This will help you find ones that contain suspicious links or content that isn\u2019t relevant to the article to which they were posted. Then, you can choose to block IP addresses corresponding to the comments you determined were spam or malicious.<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;22px&#8221;]<ul class=\"qodef-unordered-list-item qodef-toc\">\n    <li>\n\t        <div class=\"qodef-ul-title-holder\">\n            <span class=\"qodef-ul-title-content\"><strong>Raw access logs<\/strong><\/span>        <\/div>\n            <\/li>\n<\/ul>[vc_empty_space height=&#8221;28px&#8221;][vc_column_text]If you were exposed to a brute force or a DDOS attack, you should try to identify and block the IP addresses where the attack(s) originated. To do so, you will need to review the raw access logs of all IP addresses that accessed your website. You will be able to do so in the options of your hosting control panel. In our case, that\u2019s cPanel.<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]To start, <strong>connect to cPanel<\/strong> using your credentials, <strong>find the <em>Raw Access<\/em> option<\/strong> located in the Metrics section, and <strong>click on it<\/strong>.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"969\" height=\"518\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/C-Panel-Access.jpg\" class=\"attachment-full size-full\" alt=\"C Panel Access\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/C-Panel-Access.jpg 969w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/C-Panel-Access-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/C-Panel-Access-768x411.jpg 768w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/C-Panel-Access-620x331.jpg 620w\" sizes=\"auto, (max-width: 969px) 100vw, 969px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]Thanks to this option. you will be able to see the current raw access log that contains data only from the last few hours, as well as the archived log. The archived log contains all the information on requests to your site made in the current month and the previous ones unless it\u2019s been configured otherwise.<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]<strong>Clicking on the <em>Raw Access<\/em> option will download a .gz zipped file.<\/strong> Make sure you have a program that can handle zipped files of this type to be able to open it (e.g. <a href=\"https:\/\/www.7-zip.org\/\" target=\"_blank\" rel=\"noopener\">7-Zip<\/a>). <strong>Within the zipped file, you will find a log file that can be opened using your preferred text editor.<\/strong>[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]<strong>All distinct lines of code within the log file show all the times a user has accessed some part of your website and include the IP address of that user at the start.<\/strong> Therefore, these are the addresses you will need to review and pick out those that seem suspicious. But, to prevent mishaps such as blocking yourself or any other valid users, <strong>we suggest using an IP lookup tool. There are several available online and you can use them to cross-reference the IP addresses, one by one, using the blacklist check feature available within the tool.<\/strong>[\/vc_column_text][vc_empty_space height=&#8221;72px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h3 class=\"qodef-h5\"><a id=\"ways-of-blocking-ip-address\"><\/a>Ways of blocking an IP address<\/h3>\n<p>[\/vc_column_text][vc_column_text]Since you now know how to inspect IP addresses, we can review the methods you can use to block some of them. Those include using plugins, employing cPanel options, or editing the .htaccess file.<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;22px&#8221;]<ul class=\"qodef-unordered-list-item qodef-toc\">\n    <li>\n\t        <div class=\"qodef-ul-title-holder\">\n            <span class=\"qodef-ul-title-content\"><strong>Blocking an IP address using plugins<\/strong><\/span>        <\/div>\n            <\/li>\n<\/ul>[vc_empty_space height=&#8221;28px&#8221;][vc_column_text]Whenever you wish to enable a new feature on your website, you should look into possible WordPress plugins for it first. This option is very convenient for the majority of WordPress users, especially for those with less of a technical background.<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]Thanks to the number and variety of WordPress plugins, it is very easy to find one to cover almost any feature or functionality. In the case of IP blocking, you should take a look at some security plugins, as this feature is often included within security plugins. Depending on which plugin you choose, IP blocking could be included either with the free or the premium version of it.<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]A security plugin that we found useful for this purpose is the <a href=\"https:\/\/wordpress.org\/plugins\/all-in-one-wp-security-and-firewall\/\" target=\"_blank\" rel=\"noopener\">All In One WP Security &amp; Firewall<\/a>. It is a very user-friendly plugin that is also free. It also includes various quality security features: IP blocking, backup scheduling, monitoring of user accounts and files, firewall protection, anti-spam options, and much more. Because of that, we have opted to use this plugin in the following example.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]<a href=\"https:\/\/qodeinteractive.com\/magazine\/how-to-install-a-wordpress-plugin\/\">Install the plugin<\/a>, then <strong>navigate to WP Security &gt; Blacklist Manager. You must read and apply the precautionary measures before using this feature. You can see what those are by clicking on the link at the top.<\/strong> Afterward, <strong>tick the checkbox next to the <em>Enable IP or User Agent Blacklisting<\/em> option. Insert the IP address you wish to block<\/strong> and <strong>press the <em>Save Settings<\/em> button<\/strong> below. If you click on the <em>More info<\/em> button below the IP address field, you will get information regarding how to properly insert IPs. As you can see from the screenshot below, you can insert multiple IP addresses at the same time, so long as each is in a new line.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"969\" height=\"609\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Plugin-WP-Security.jpg\" class=\"attachment-full size-full\" alt=\"Plugin WP Security\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Plugin-WP-Security.jpg 969w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Plugin-WP-Security-300x189.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Plugin-WP-Security-768x483.jpg 768w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Plugin-WP-Security-620x390.jpg 620w\" sizes=\"auto, (max-width: 969px) 100vw, 969px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]Similarly, <strong>if you wish to remove an IP address from the block list, simply remove the line that contains it, and press the <em>Save Settings <\/em>button afterward. However, if you don\u2019t want to block any IPs, you should uncheck the box next to the <em>Enable IP or User Agent Blacklisting<\/em> option and then press the <em>Save settings<\/em> button.<\/strong>[\/vc_column_text][vc_empty_space height=&#8221;22px&#8221;]<ul class=\"qodef-unordered-list-item qodef-toc\">\n    <li>\n\t        <div class=\"qodef-ul-title-holder\">\n            <span class=\"qodef-ul-title-content\"><strong>Blocking an IP address using cPanel<\/strong><\/span>        <\/div>\n            <\/li>\n<\/ul>[vc_empty_space height=&#8221;28px&#8221;][vc_column_text]Another way of blocking IP addresses is via the options of your hosting control panel. As we mentioned earlier, we will be using cPanel for our showcase.<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]To carry out the steps, <strong>log in to cPanel<\/strong> using your credentials and <strong>click on the<em> IP Blocker<\/em> option<\/strong>, located in the Security section.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"969\" height=\"518\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Cpanel-Security-IP-Blocker.jpg\" class=\"attachment-full size-full\" alt=\"Cpanel Security IP Blocker\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Cpanel-Security-IP-Blocker.jpg 969w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Cpanel-Security-IP-Blocker-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Cpanel-Security-IP-Blocker-768x411.jpg 768w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Cpanel-Security-IP-Blocker-620x331.jpg 620w\" sizes=\"auto, (max-width: 969px) 100vw, 969px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]At the top of the page that opens, <strong>insert the IP address you want to block into the appropriate field<\/strong> and <strong>press the <em>Add<\/em> button<\/strong>. Below this button cPanel helpfully lists the suitable formats for inserting IP addresses, both IPv4 and IPv6. It gives instructions for single IP addresses, addresses range, CDR format, and wildcard operators. Make sure to review those notes if you aren\u2019t sure how to enter the IP address(es) you want to block properly.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"969\" height=\"518\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Cpanel-Add-IP.jpg\" class=\"attachment-full size-full\" alt=\"Cpanel Add IP\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Cpanel-Add-IP.jpg 969w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Cpanel-Add-IP-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Cpanel-Add-IP-768x411.jpg 768w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Cpanel-Add-IP-620x331.jpg 620w\" sizes=\"auto, (max-width: 969px) 100vw, 969px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]Shortly after successfully performing all the steps, <strong>you will see a confirmation message<\/strong>.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"969\" height=\"518\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Cpanel-IP-Blocker.jpg\" class=\"attachment-full size-full\" alt=\"Cpanel IP Blocker\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Cpanel-IP-Blocker.jpg 969w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Cpanel-IP-Blocker-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Cpanel-IP-Blocker-768x411.jpg 768w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Cpanel-IP-Blocker-620x331.jpg 620w\" sizes=\"auto, (max-width: 969px) 100vw, 969px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]As you can see, the process is rather simple. <strong>You can click on the <em>Go Back<\/em> button<\/strong> if you wish to return to the previous page and block more IP addresses.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]Additionally, the IP that you blocked will be added to the list of blocked addresses shown on the IP Blocker page, near the bottom. From there, <strong>you will have the option to enable access to an IP address that you previously blocked. If you want to do so, you just need to scroll down to the <em>Currently Blocked IP Addresses<\/em> section, locate the IP address you wish to remove from the list, and press the <em>Delete<\/em> button next to it.<\/strong>[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"969\" height=\"518\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Cpanel-Delete-Button.jpg\" class=\"attachment-full size-full\" alt=\"Cpanel Delete Button\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Cpanel-Delete-Button.jpg 969w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Cpanel-Delete-Button-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Cpanel-Delete-Button-768x411.jpg 768w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Cpanel-Delete-Button-620x331.jpg 620w\" sizes=\"auto, (max-width: 969px) 100vw, 969px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]To confirm your choice of whitelisting an IP address, press the <em>Remove IP<\/em> button that shows afterward.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"969\" height=\"518\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Cpanel-Remove-IP.jpg\" class=\"attachment-full size-full\" alt=\"Cpanel Remove IP\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Cpanel-Remove-IP.jpg 969w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Cpanel-Remove-IP-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Cpanel-Remove-IP-768x411.jpg 768w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Cpanel-Remove-IP-620x331.jpg 620w\" sizes=\"auto, (max-width: 969px) 100vw, 969px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]When that\u2019s done, you will see a success message.<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"969\" height=\"518\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Cpanel-Success-Message.jpg\" class=\"attachment-full size-full\" alt=\"Cpanel Success Message\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Cpanel-Success-Message.jpg 969w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Cpanel-Success-Message-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Cpanel-Success-Message-768x411.jpg 768w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Cpanel-Success-Message-620x331.jpg 620w\" sizes=\"auto, (max-width: 969px) 100vw, 969px\" \/>                        <\/div>\n<\/div>[vc_empty_space]<ul class=\"qodef-unordered-list-item qodef-toc\">\n    <li>\n\t        <div class=\"qodef-ul-title-holder\">\n            <span class=\"qodef-ul-title-content\"><strong>Blocking an IP address by editing the .htaccess file<\/strong><\/span>        <\/div>\n            <\/li>\n<\/ul>[vc_empty_space height=&#8221;28px&#8221;][vc_column_text]IP blocking is just one of many things you can achieve by editing the .htaccess file. We will show how to edit this file using FTP. As a requirement for this approach, you need to know <a href=\"https:\/\/qodeinteractive.com\/magazine\/how-to-use-ftp\/\">how to use an FTP client<\/a> and you need to have one installed. Additionally, as the .htaccess file is hidden, you will need to <a href=\"https:\/\/qodeinteractive.com\/magazine\/find-htaccess-file-on-wordpress-site\/\">enable the options for showing hidden files<\/a> in your FTP client. Also, we suggest <a href=\"https:\/\/qodeinteractive.com\/magazine\/how-to-manually-backup-wordpress-website\/\">making a backup of your site<\/a> as a safety precaution beforehand.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]Then, <strong>connect to your server<\/strong> using your FTP credentials and <strong>navigate to your root WordPress directory<\/strong>, often called public_html. Within it, <strong>locate the .htaccess file, right-click on it<\/strong>, and <strong>press the <em>View\/Edit<\/em> option<\/strong> from the menu that appears.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"969\" height=\"518\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Htaccess.jpg\" class=\"attachment-full size-full\" alt=\"Htaccess\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Htaccess.jpg 969w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Htaccess-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Htaccess-768x411.jpg 768w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Htaccess-620x331.jpg 620w\" sizes=\"auto, (max-width: 969px) 100vw, 969px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]<strong>Then insert the code given below. Make sure to replace the XXX.XXX.XXX.XXX part with a valid IPv4 address. If you wish to block an IPv6 address, replace the XXX.XXX.XXX.XXX part with a properly written IPv6 address. In case you wish to block multiple IPs, simply put additional Deny statements, one below the other, each with a valid and distinct IP address you wish to block.<\/strong>[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Order Allow,Deny\r\nAllow from all\r\nDeny from XXX.XXX.XXX.XXX<\/pre>\n<p>[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"969\" height=\"518\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Htaccess-2.jpg\" class=\"attachment-full size-full\" alt=\"Htaccess\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Htaccess-2.jpg 969w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Htaccess-2-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Htaccess-2-768x411.jpg 768w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Htaccess-2-620x331.jpg 620w\" sizes=\"auto, (max-width: 969px) 100vw, 969px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]After inserting the code, <strong>save the changes you made<\/strong>. Then <strong>upload the .htaccess file back to your server<\/strong>, which will override the older version of that file.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]Additionally,<strong> if you wish to re-enable access to the IP address you blocked, you can do so simply by removing the block of code you added. In case you inserted multiple Deny statements, you can remove only the one that contains the IP you wish to whitelist.<\/strong>[\/vc_column_text][vc_empty_space height=&#8221;72px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h3 class=\"qodef-h5\"><a id=\"additional-tips\"><\/a>Additional tips<\/h3>\n<p>[\/vc_column_text][vc_column_text]Even though IP blocking is quite useful, as it can block single addresses and even regions, it doesn\u2019t keep your site safe against all malicious activity. It can work wonders against spam, but more sophisticated hacking attacks won\u2019t be deterred by IP blocking. As such, we advise looking into additional measures such as firewalls with strict security rules. These can be set by your hosting provider or through the use of one of the <a href=\"https:\/\/qodeinteractive.com\/magazine\/wordpress-security-plugins\/\">top quality security plugins<\/a>.[\/vc_column_text][vc_empty_space height=&#8221;68px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h2 class=\"qodef-h4\">Final Thoughts<\/h2>\n<p>[\/vc_column_text][vc_column_text]Inspecting and blocking IP addresses is a simple and effective way of battling against spam and hacking attempts. In this article, we have carefully covered three possible ways you can block an IP address in WordPress. The methods are quite straightforward, and we are confident you will be able to apply them and improve your site security in no time. This is only a part of having tight site security, so we suggest you implement other measures in addition to this to keep your peace of mind.<br \/>\n[\/vc_column_text][\/vc_column][\/vc_row]<\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>One of the basic security measures in WordPress is knowing how to block an IP. Join us in exploring the different whys and hows of blocking IP addresses.<\/p>\n","protected":false},"author":11229,"featured_media":18943,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[34,4,13],"class_list":["post-18777","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-security","tag-tips","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/posts\/18777","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/users\/11229"}],"replies":[{"embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/comments?post=18777"}],"version-history":[{"count":0,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/posts\/18777\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/media\/18943"}],"wp:attachment":[{"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/media?parent=18777"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/categories?post=18777"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/tags?post=18777"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}