How to Block Specific Domains/IP Addresses from Accessing your Wordpress and/or HTML Site

5 replies
Today I had to hunt down directions on this.

If someone is leeching your videos, images and/or bandwidth, iframing your salespage, tracking your PPC Campaigns, etc and you need to ban an entire domain or IP, here are the super simple steps.

Edit the .htaccess file in your Wordpress Root Directory. If it's HTML, create one. (Tutorial vids here)

Inside the Wordpress .htaccess file you'll find the following:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>


Simply add the following to the end of the Wordpress .htaccess file. If you don't have Wordpress, then the lines below are all you need.

# END WordPress
<Limit GET>
order allow,deny
deny from thedomaintoblock.com
deny from anotherdomaintoblock.com
deny from yetanotherdomaintoblock.com
deny from 66.96.251.28
allow from all
</Limit>


Add/remove "deny from" rules to your heart's content. Then save and reupload to the Wordpress Root or HTML site root.

This is what the final .htaccess file should look like for Wordpress:

Code:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
 <Limit GET>
 order allow,deny
 deny from thedomaintoblock.com
deny from anotherdomaintoblock.com
deny from yetanotherdomaintoblock.com
 deny from 66.96.251.28
 allow from all
 </Limit>
For HTML, it'll look like this:

Code:
  <Limit GET>
  order allow,deny
  deny from thedomaintoblock.com
 deny from anotherdomaintoblock.com
 deny from yetanotherdomaintoblock.com
  deny from 66.96.251.28
  allow from all
  </Limit>
That's it.

Note: This is to prevent a specific domain or IP from accessing your website completely. Do not block sites like Google, Yahoo or Clickbank!

BIG P.S. This could also work to block Keyword Discovery, Compete.com, PPC Bully and SpyFu from finding your landing pages and indexing them.
#accessing #addresses #and or or #block #domains or ip #html #site #specific #wordpress
  • Profile picture of the author agoda73
    Hello Jesus Perez,

    I hope you are still active on WF as I have a question for you regarding your article.

    I have a WP site that when it is loading some pages it is loading data from places such as bizographics.com, rlcdn.com, adnxs.com and nexac.com.

    The only thing I can think it could be is some hidden pixel tracking on images I have used.

    I am using the DIVI theme from Elegant Themes. Any advice would be appreciated.
    Signature

    Steven Hodgkiss
    Authorised Distributor of 2 Minute Miracle Gel

    {{ DiscussionBoard.errors[9997879].message }}
  • Profile picture of the author nizamkhan
    This may come in handy. BIG P.S. is smart Thanks for sharing

    - Nizam
    {{ DiscussionBoard.errors[9998071].message }}
  • Profile picture of the author Paul Guilfoyle
    Please correct me if I'm wrong.
    For the non technically minded like me the free wordfence plug in seems to do this without having to know any code.
    Also I've just started using Cloudfare - the free version allows you to block IP addresses and even whole countries and is very easy to use.
    No affiliate relationship.
    Signature

    Easiest, fastest way I know, and working for countless others to create an online income.
    Click Here to Watch Free Video and start learning how to really profit from the internet

    {{ DiscussionBoard.errors[9998129].message }}
  • Thanks for the share?

    However, they can still use apps like..

    WhatRunsWhere.com
    Follow.net
    StatsCrop
    Alexa

    To track many aspects of your website
    Signature

    [CENTER][B]==> Do you want to make money online? [/B]
    Free video: How regular people are making 6-figures per month on the internet! [URL="http://www.clkmg.com/fc27/UDCL-IN2WF"][B]Watch this free video now![/B][/URL] <==[/CENTER]

    {{ DiscussionBoard.errors[9998131].message }}
  • Profile picture of the author KenW3
    Originally Posted by Paul Guilfoyle

    For the non technically minded like me the free wordfence plug in seems to do this without having to know any code. Also I've just started using Cloudfare - the free version allows you to block IP addresses and even whole countries and is very easy to use.
    Another highly useful WordPress plugin that does this is IQ Block Country. It will block by IP or by country, with both frontend and backend blocking handled separately. (The plugin does require you to upload an IP database to your site.)

    I use -both- Wordfence (free version) and IQ Block Country on WordPress sites, and suggest you block every country, except your own, from the backend administrator side. Countries shown to be causing the most problems (shown in the reports) can also be blocked from the front.

    Set it up on a site you think is not getting much attention from hackers, then look at the Logging tab the next day. A strong defense never hurts for the relentless hacking attempts made on WordPress sites.
    {{ DiscussionBoard.errors[9998843].message }}

Trending Topics