Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Let's say I have the sites siteA.com and siteB.com. They are hosted such that siteB.com actually points to siteA.com/siteB.

How can I block someone from visiting siteA.com/siteB using mod_rewrite?

So far I've tried this to no avail (in root of siteA.com):

RedirectMatch 301 ^/siteB/$ http://someothersite.com/
share|improve this question

migrated from serverfault.com Mar 6 '11 at 2:26

This question came from our site for system and network administrators.

1 Answer 1

up vote 1 down vote accepted

Try something like

# you may need to drop the leading slash if you're doing this in .htaccess   
RewriteCond %{HTTP_HOST} !^siteB\.com$
RewriteRule ^/siteB  http://siteB.com/ [R=301]
share|improve this answer
    
Thank you very much! –  Chris Laplante Mar 7 '11 at 22:03

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.