limit access to a web folder based on subdomain
I have a folder off my webroot that is linked to a subdoma开发者_运维知识库in. The folder can be accessed from either sub.domain.com or domain.com/sub ... I want to limit access ONLY to people accessing it from the subdomain. I'm currently doing this in php on the index page but I'm sure theres a better way. Advice?
I would have move that directory outside the domain.com
folders.
Then you point your sub.domain.com
virtual host to this new directory.
Maybe you can also use the rewrite engine to redirect domain.com/sub
on a error 403 Forbidden
RewriteRule ^sub/.*$ - [F]
精彩评论