开发者

limit access to a web folder based on subdomain

开发者 https://www.devze.com 2023-02-20 05:49 出处:网络
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 accessi

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]
0

精彩评论

暂无评论...
验证码 换一张
取 消