+ Reply to Thread
Results 1 to 2 of 2

Thread: Block certain IP range from accessing reg page

  1. #1

    Block certain IP range from accessing reg page

    So, I have a certain IP range for example

    1.52.0.0/14
    2.56.16.0/22
    2.59.0.0/23
    14.0.16.0/20
    14.160.0.0/11
    14.224.0.0/11
    17.81.145.0/24
    17.92.240.0/23
    20.134.144.0/20
    20.134.208.0/24
    20.134.243.0/24
    20.139.144.0/20
    23.50.12.0/22
    23.53.208.0/21
    23.60.70.0/23
    23.61.254.0/23
    23.79.96.0/19
    23.91.108.0/24
    23.194.136.0/23
    How do I write a htaccess rule to block the IP range above from accessing this only page:
    www.domain.com/sign-up.html

    But they can visit and see other pages just fine.

  2. #2
    So I found this

    RewriteEngine on
    RewriteBase /
    RewriteCond %{REMOTE_ADDR} 1.52.0.0/14 [OR]
    RewriteCond %{REMOTE_ADDR} 2.56.16.0/22 [OR]
    RewriteCond %{REMOTE_ADDR} 2.59.0.0/23 [OR]
    RewriteCond %{REMOTE_ADDR} 14.0.16.0/20
    RewriteCond %{REQUEST_URI} /sign-up.html$
    RewriteRule .* /signup_update.php [R=301,L]
    Basically I found the code above in htaccess will block the ip range from accessing my www.domain.com/sign-up.html page and instead will be redirect to www.domain.com/signup_update.php just as I want. But it doesn't work. So weird. Any idea?

+ Reply to Thread