I have multiple domains pointing to the same site.

Example:

I have www.admin-domain.com pointing to /var/www

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

Example:

www.admin-domain.com/test shows the same content as www.test.com

Using a .htaccess file how do I block www.admin-domain.com/test ?

link|improve this question
feedback

2 Answers

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.

link|improve this answer
I tried as you said but I still have access to <code>www.admin-domain.com/test</code> – stevs986 Nov 3 '11 at 16:07
feedback

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

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

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

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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