• X

    Block Visitors From Specific IP Address Using .htaccess method

    By in WordPress

    Bluehost hosting

    We have already covered some interesting topics on wordpress .htaccess hacks.

    This post can be used for wordpress or for any website, by editing your .htaccess file. If you are not familiar with .htaccess file, refer to above mentioned post or get in touch with your hosting CC. wordpress logo thumb2 Block Visitors From Specific IP Address Using .htaccess method

    If you are receiving Spam comments and other such activities from some person at a specific IP address, then you can easily deny access to your site by creating .htaccess file with the below mentioned code in it.

    First identify the IP address of that visitor. There are two methods for this (I prefer these) :

    • If that visitor already commented in your blog, then you can find that person’s IP address easily from your WP dashboard.

    Create .htaccess file and type the following code in it.

    <Limit GET POST PUT>
    order allow,deny
    allow from all
    deny from 12.345.67.890

    Here is 12.345.67.890 is the IP address of the person you want to block. You can replace this with your visitor IP address. Allow Visitors From Specific IP Address Using .htaccess

    By this simple hack in your .htaccess file, you can block access to your blog from every IP addresses except the IP addresses you specified in the code.

    It is used mostly when your blog is under construction and you don’t want your readers to see the site until it is over or even search engine spiders indexing problems.

    <Limit GET POST PUT>
    order deny,allow
    deny from all
    allow from 12.345.67.890

    Note that   each IP address is placed on a new line.

    <Limit GET POST PUT>
    order deny,allow
    deny from all
    allow from 12.345.67.890
    allow from 890.67.345.12

    Replace the given IP address with your desired IP address.

    If you like this post and find it to be informative, don’t forget to tweet it.


    Editor note : This is Guest post from Pradeep, who writes about Technology, Blogging at hellboundbloggers.  Like Pradeep you can also write for Shoutmeloud, for more information shoutmeloud Revenue sharing guest blog program read here.

    Subscribe to Download WordPress Guide Worth $99

    Discover more awesome articles

    Article by

    S.Pradeep has written 1 articles.

    If you like This post, you can follow ShoutMeLoud on Twitter. Subscribe to Blogging tips via RSS or EMAIL to receive instant updates.

    { 2 comments… read them below or add one }


    Generally i use .htaccess to restrict folder access to certain ip addresses. its a great tool.



    hey thanks for this post pradeep ,i was searching for this and got it……


    Leave a Comment

    Previous post:

    Next post: