Deny access to a specific page by IP
Denying access to a specific page by IP address in .htaccess file:
RewriteEngine On
RewriteCond %{REMOTE_ADDR} =12.34.56.78
RewriteRule ^your-page\.html$ - [F,NC]
Commentary
Enabling runtime rewriting engine:
RewriteEngine On
Telling what IP address to block:
RewriteCond %{REMOTE_ADDR} =12.34.56.78
Forbidding [F] access to your-page.html, matching is case-insensitive [NC]:
RewriteRule ^your-page\.html$ - [F,NC]
Notes
- There is no space between "=" (equals sign) and IP address numbers.
- Apache Module mod_rewrite: http://httpd.apache.org/docs/current/mod/mod_rewrite.html
- RewriteRule flags: https://httpd.apache.org/docs/2.4/rewrite/flags.html
Web servers
- Apache