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/

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]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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