KOMPX.COM or COMPMISCELLANEA.COM   

Deny access to a specific page for an IP address range

Denying access to a specific page for an IP address range in .htaccess file:


RewriteEngine On
RewriteCond %{REMOTE_ADDR} ^123\.45\.
RewriteRule ^your-page\.html$ - [F,NC]

Commentary

Enabling runtime rewriting engine:


RewriteEngine On

Telling what IP address range to block:


RewriteCond %{REMOTE_ADDR} ^123\.45\.

Forbidding [F] access to your-page.html, matching is case-insensitive [NC]:


RewriteRule ^your-page\.html$ - [F,NC]

Denying access to a specific page for multiple IP address ranges


RewriteEngine On
RewriteCond %{REMOTE_ADDR} ^123\.45\. [OR]
RewriteCond %{REMOTE_ADDR} ^678\.90\.
RewriteRule ^your-page\.html$ - [F,NC]

Notes

  1. Apache Module mod_rewrite: http://httpd.apache.org/docs/current/mod/mod_rewrite.html
  2. RewriteRule flags: https://httpd.apache.org/docs/2.4/rewrite/flags.html
Web servers
More