Denying access for Sub Domain only
I like to block access to a subdomain to everyone except for one IP. I cannot drop an .htaccess file in this folder as the domain itself requires access.
www.domain.com has access to the following directory
/home/domain.com/public_html/photos
sub.domain.com points and to this same directory
/home/domain.com/public_html/photos
If I place the following into that directory this blocks everything for both domains accessing it.
order allow,deny
deny from all
allow from xx.xx.xx.xx
Is there another options I can use so that www.domain.com ignores it and sub.domain.com reads it.
-
You may be able to achieve what you want using a mod rewrite rule (perhaps using HTTP_REFERER ?) I would suggest you test for the domain with no prefix, and also the domain with the www prefix OR use an IF NOT sub.domain.com ...... Hope this helps mod_rewrite - Apache HTTP Server Version 2.4 0 -
You may be able to achieve what you want using a mod rewrite rule (perhaps using HTTP_REFERER ?) I would suggest you test for the domain with no prefix, and also the domain with the www prefix OR use an IF NOT sub.domain.com ...... Hope this helps mod_rewrite - Apache HTTP Server Version 2.4
That is what I just finished adding. And tried it, all seems to be working. Just need to check the connecting server that has access. Thanks!0 -
Hello, I'm glad to see you were able to find a suitable solution. Thank you for updating us with the outcome. 0
Please sign in to leave a comment.
Comments
3 comments