使用 .htaccess 限制对文件的访问
我在同一帐户上托管了 2 个域,但我想限制第二个域不访问文件。
我有 abc123.com 和 zyx987.com。
在我的 php 中,我做了所有需要的事情来显示域名和基于域的模板,但我只想从 abc123.com 访问 /download 文件。
下载文件夹包含以下文件:file1.pdf 或 file2.zip。
我尝试了“拒绝所有人”,但这不起作用,因为其他域也被阻止了。
还有别的办法吗?
I have 2 domains hosted on the same account but I want to restrict the second one to not access files.
I have abc123.com and zyx987.com.
In my php I do everything I need to display the domain name and template based on the domain but I want only the /download files to be accessed from abc123.com.
The download folder has files like: file1.pdf or file2.zip.
I tried the 'deny from all' but this didnt work since the other domain is blocked too.
Is there another way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是你必须做的。将其放入您的 .htaccess
这将阻止任何请求,例如:
并拒绝许可。
Here's what you have to do. Put this in your .htaccess
This will block any request like:
and give a permission denied.