Block file from accessing using .htaccess for a subdomain
I have a website for e.g.
www.domain.com
开发者_开发问答
And I have another subdomain for e.g.
test.domain.com
Both my main and subdomain point to same directory which is public_html.
I want to block access to
test.domain.com/test.jpg
but not
domain.com/test.jpg
Please note that this test.jpg is same file for both main and subdomain as they both point to same directory. So how do I block it for subdomain but not for main domain using .htaccess? Or is there any other way of doing that?
Thanks
An .htaccess file will be used regardless of the virtual host (unless explicitly deactivated using AllowOverride None), therefore you'll have to put:
<Files /full/path/to/test.jpg>
Deny From All
</Files>
in the apache configuration file inside the test.domain.com
virtual host configuration.
精彩评论