仅允许特定 ip 访问站点并允许所有访问特定文件

发布于 2024-09-27 20:51:41 字数 431 浏览 0 评论 0原文

我的 httpd.conf 中有这个配置,

<Directory />
    AllowOverride none
    Order Deny,Allow
    Deny from all
    Allow from 66.220.144.0/20 69.63.176.0/20
</Directory>

<Files crossdomain.xml>
    Order deny,allow
    Allow from all
</Files>

我想要实现的是允许 facebook 访问 Web 应用程序并拒绝其他人,但允许每个人访问文件 crossdomain.xml。不幸的是,上述配置不起作用。上述配置的结果是 crossdomain.xml 文件仍然被阻止。谁能帮我完成这个配置吗?

谢谢!

I have this configuration in my httpd.conf

<Directory />
    AllowOverride none
    Order Deny,Allow
    Deny from all
    Allow from 66.220.144.0/20 69.63.176.0/20
</Directory>

<Files crossdomain.xml>
    Order deny,allow
    Allow from all
</Files>

What I am trying to achive is allow facebook to access the web application and deny everyone else but allow everybody to access the file crossdomain.xml. Unfortunately the above configuration is not working. The result of the above config is the crossdomain.xml file is still being blocked. Can anyone help me on this configuration?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

对岸观火 2024-10-04 20:51:41

http://httpd.apache.org/docs/2.0/mod/ core.html#目录

目录路径是完整路径
到目录或通配符字符串
使用 Unix shell 风格的匹配。

因此,您的 标记应使用文档根文件夹的完整路径,而不是相对于网站的路径。

Per http://httpd.apache.org/docs/2.0/mod/core.html#directory:

Directory-path is either the full path
to a directory, or a wild-card string
using Unix shell-style matching.

So your <Directory> tag should be using the full path to the document root folder, not the path relative to the website.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文