Mobile app version of vmapp.org
Login or Join
Merenda212

: How to block access to a sub-site with mod_rewrite? 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

@Merenda212

Posted in: #Apache #Htaccess #ModRewrite #Url #UrlRewriting

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/$ someothersite.com/

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Merenda212

1 Comments

Sorted by latest first Latest Oldest Best

 

@Sent6035632

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 siteB.com/ [R=301]

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme