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 have an Apache 2 running on a Linux box. Currently there at only 2 webpages in different paths:

/website1/site
/website2/site

I set apache to not server directory listings and I set the error documents to show a blank page when hitting something that doesn't exit.
I was wondering, is there any way force Apache to always return 404 or other error every time something other than those two websites are hit?

We are experiencing a lot of probes from proxy list sites and other places and all I want to do is just send an error every time they try / or any other path, without serving anything, not error pages, blank pages, etc.

helps is appreciated.

share|improve this question
    
"I was wondering, is there any way force Apache to always return 404 or other error every time something other than those two websites are hit?" If it's not giving an error already, then it's serving content that doesn't exist? I'm confused. What happens when they try to access a website that apache isn't serving? –  Kyle Buser Oct 18 '10 at 17:44

1 Answer 1

up vote 0 down vote accepted

You could add a few mod_rewrite directives to throw them for a loop:

<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{HTTP_HOST} ^1\.2\.3\.4$
    RewriteRule .* http://%{REMOTE_ADDR} [R=301]
</IfModule>

(where 1\.2\.3\.4 is a regexp matching your server's IP address(es) ...)

share|improve this answer

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.