Mobile app version of vmapp.org
Login or Join
YK1175434

: Restrict access to directories hosting different sites My hosting provider requires that my primary domain (let's call it example.com) points to my public_html root. I also own several other domains

@YK1175434

Posted in: #Directory #Htaccess #WebHosting

My hosting provider requires that my primary domain (let's call it example.com) points to my public_html root. I also own several other domains (let's call them exampleA.com and exampleB.com) that are hosted in sub-directories such that they can be accessed via example.com/exampleA/ and example.com/exampleB/
I would like to restrict people from accessing these secondary sites in this way. Ideally, there will be no indication that the secondary sites are in any way related to the primary domain. How do I do this? Modify the .htaccess file?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @YK1175434

1 Comments

Sorted by latest first Latest Oldest Best

 

@Goswami781

This should do it

RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com$ [NC]
RewriteRule ^exampleB/ - [R=404,L]


(Adapted from this answer but I think mine is right whereas the first example in that one is wrong as it uses the wrong domain in RewriteCond. That should be enough, but you could try the other things in that question if it doesn't work.)

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme