[英]Deny direct access to files in folder
My client has a requirement: 我的客户有一个要求:
I know I can make pages private and put a password on folder using .htaccess but have no idea about the points above. 我知道我可以将页面设为私有,并使用.htaccess将密码放在文件夹中,但对以上几点一无所知。 The site is on Linux Server.
该站点位于Linux Server上。
Any idea about this? 有什么想法吗?
With .htaccess there is a way to check the REFERRER. 使用.htaccess,可以检查REFERRER。 This should match your domain (or a folder for that instance).
这应该与您的域(或该实例的文件夹)匹配。
RewriteEngine On
RewriteCond %{HTTP_REFERER} !mydomain\.com/page
RewriteRule ^ - [L,F]
You should add this in a new .htaccess of the folder you wish to protect. 您应该将其添加到要保护的文件夹的新.htaccess中。 Although, this is not foolproof.
虽然,这并非万无一失。 REFERRERS can be spoofed.
推荐人可以被欺骗。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.