Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have multiple domains pointing to the same site.


I have pointing to /var/www

I have pointing to /var/www/test directory and this is OK.

Example: shows the same content as

Using a .htaccess file how do I block ?

share|improve this question

Drop a .htaccess file into /var/www with belows content:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.admin-domain\.com [NC]
RewriteCond %{REQUEST_URI} ^/test/.*
RewriteRule ^(.*)$ - [F,L]

but your example seems to contradict to what you said before.

share|improve this answer
I tried as you said but I still have access to <code></code> – stevs986 Nov 3 '11 at 16:07

Create a .htaccess in the /var/www/test directory with the following contents

RewriteEngine On
RewriteConnd %{HTTP_HOST} !$
RewriteRule (.*) - [F]

If the vhost accessing the file isn't then the server will return a 403 Forbidden message.

share|improve this answer

Your Answer


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.