Allow specific page for only one IP address

Home Forums BulletProof Security Pro Allow specific page for only one IP address

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #39288
    Zsolt Edelényi
    Participant

    Hi,

    I have an url in my website which should be restricted by all  visitors except, but one with a specific IP address. Can I say to BPS to block this url  for accessing from every IP except one?

    Regards, Zsolt

     

    #39292
    AITpro Admin
    Keymaster
    # Allow access to a website URI/URL based on IP Address
    RewriteCond %{REQUEST_URI} ^(.*/website-url/|.*/another-website-url/)$
    # Add your Public IP Address using 2 or 3 octets so that if/when
    # your IP address changes it will still be in your subnet range. If you
    # have a static IP address then use all 4 octets.
    # Examples: 2 octets: 65.100. 3 octets: 65.100.50. 4 octets: 65.100.50.1
    RewriteCond %{REMOTE_ADDR} !^65\.100\.50\.$
    RewriteRule ^(.*)$ - [F,L]

    IMPORTANT NOTES: This URI|URL IP Address Allow htaccess code MUST be saved in this BPS Root Custom Code text box (BEFORE/ABOVE any htaccess caching code): 1. CUSTOM CODE TOP PHP/PHP.INI HANDLER/CACHE CODE. The .* htaccess code in front of the REQUEST_URI condition is critical. The code will not work correctly if you do not add the .* in front of the URI|URL.

    Also you only need to add the last part of the URI and not the entire URI.

    Example:
    www.example.com/650/category/another-sub-category/website-url/
    You would only need the last part of the URI in your htaccess code:  .*/website-url/

    Or if this is a WordPress Post or Page you can use the built-in WordPress Visibility options on the Post or Page Editor page for a Post or Page to make it Private or Password Protected.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.