Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want my apache to return 404 for all HTTP GET requests. Including HTTP GET /.

Tried to play a bit with mod_rewrite for this (404.gif obviously does not exits)

                    RewriteEngine on
                    RewriteRule .* 404.gif [L]

But it doesn't seem to be acting very nice, this for some reason returns 400 Bad Request.

Could someone please provide a configuration example for apache 2 that will cause it to always return the wonderful 404 ?

p.s. Forgot to mention, I will be using this configuration for both HTTP & HTTPS.

Thank you, Maxim.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Point the apache root directory to a blank directory. Why do you need this behavior?

share|improve this answer
    
EC2 Server farm upgrade, when I upgrade one of the HTTPS servers I don't want all requests to it get swollen by EC2 Great firewall - So I would rather move the elastic ip of the server to another server, which always returns 404. My procedure is to move the elastic ip, upgrade the server, return the elastic ip to the original node. –  Maxim Veksler Jul 28 '10 at 15:07
    
I've pointed the document root to a non existing directory. Blank gives directory listing when requested with "/" –  Maxim Veksler Jul 28 '10 at 15:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.