Solved

mod_rewrite: Send users from specific IP a 404 error

Posted on 2007-03-29
3
226 Views
Last Modified: 2011-09-20
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
Comment
Question by:rbichon
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
JamesCssl earned 250 total points
ID: 18821352
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
 
LVL 1

Author Comment

by:rbichon
ID: 18822553
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
 
LVL 11

Expert Comment

by:JamesCssl
ID: 18823394
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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question