Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 232
  • Last Modified:

mod_rewrite: Send users from specific IP a 404 error

How can I use mod_rewrite to send users from a specific IP address a 404 error when they try to access my site?
0
rbichon
Asked:
rbichon
  • 2
1 Solution
 
JamesCsslCommented:
RewriteCond %{REMOTE_ADDR} ^127.0.0.1$
RewriteRule ^.* - [F]



This would send 403 Forbidden

RewriteCond %{REMOTE_ADDR} ^127.0.0.1$
RewriteRule ^.* - [G]

and this would send 410 Gone.  The only way I can think of to make a 404 error is to proxy to a page that produces a 404 error.
0
 
rbichonAuthor Commented:
I'll just use the 403 Forbidden one.then. It worked perfectly. Is there a way to give a 500 Internal server error instead so that they think our site is down?
0
 
JamesCsslCommented:
As with trying to generate a 404 error, generating a 500 error while the server is working perfectly would be quite difficult.
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now