I have searched Google but couldn’t figure out how to do this thing:
How can I block access to a specific directory if the request is done on a specific host.
Let me give an example.
I have a.com and b.com etc. addresses pointing to the same document root (the /).
I need to block the access to /sites/private/ directory unless the request is coming using a.com. The /sites/private/ directory should only be accessible if the request is done using a.com.
Thanks.
I can’t test this right now, but this piece of code stolen and modified from here using
SetEnvIfmight help:you can use regular expressions for the host name.