WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Block IP’s with .htaccess?

[Resolved] Block IP’s with .htaccess?

  • Hi all! I am trying to block certain IP’s from accessing my website. Mainly, my sister-in-law. (It’s a loooong story.)

    I am confused where to place this block:
    order allow,deny
    deny from 123.45.6.7
    deny from 012.34.5.
    allow from all

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

    # END WordPress

    Thanks in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Jeremy Clark

    @jeremyclark13

    Member

    Place it at the very beginning of the file. As a rule of thumb never edit or put any code between the BEGIN and END wordpress sections as it is overwritten when changing permalinks.

    Thank you so much Jeremy!

    Hello!

    I tried to do this trick in htaccess, but only files like css and js were blocked. Now, a “blocked” IP is still able to see any post and its text, he just can’t download style.css and because of that the page is all while with simple text, but it sill can read everything.

    How can I totally block access to anything in my blog?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Block IP’s with .htaccess?’ is closed to new replies.