• monkeywisdom

    (@monkeywisdom)


    Hi,

    I added some code to keep people off my wp-admin page, and suddenly that function is overactive and won’t even let me access it. Here’s the code I added to the top of htaccess (with ip address disguised with a random number).

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_URI} ^(.*)?wp-login\.php(.*)$ [OR]
    RewriteCond %{REQUEST_URI} ^(.*)?wp-admin$
    RewriteCond %{REMOTE_ADDR} !^24\.547\.24\.16$
    $RewriteRule ^(.*)$ – [R=403,L]
    </IfModule>`

    It worked fine protecting my root level domain for a while. I have four WP installations, one for the root level and three more for the subdirectory sites. The code protected people who didn’t have my ip from accessing wp-admin.

    On the root level domain, I could only access the wp-admin from my home ip, so the code was working as advertised. Today I went to a coffee shop, and I had to add #’s in front of every line of that code in htaccess to edit my site. That allowed me access.

    When I got home, to my normal ip address, I deleted the #’s so that the above code would work again. It not only blocked me out of the wp-admin (or any type of login page) of the main site and all subdirectories. It also prevented me from viewing my site at all. I’m guessing that everyone had 500 errors while attempting to view my site. I rechecked my ip and it’s the same one allowed in the code.

    Any ideas? This is strange.

  • The topic ‘Having Troubles with htaccess protection’ is closed to new replies.