小编Dav*_*hen的帖子

只允许对目录中的特定文件使用 POST 方法

我有一个只能通过 POST 方法访问的文件。

/var/www/folder/index.php
Run Code Online (Sandbox Code Playgroud)

文档根是/var/www/index.php嵌套在文件夹内。

Apache 的版本是:2.4.4。
我的配置如下:

<Directory "/var/www/folder">
    <Files "index.php">
        order deny,allow
        Allow from all
        <LimitExcept POST>
            Deny from all
        </LimitExcept>
    </Files>
</Directory>
Run Code Online (Sandbox Code Playgroud)

我访问我的服务器,127.0.0.1/folder但我可以像往常一样获取和发布文件。

我也试过颠倒顺序order allow,deny、、要求、限制除外和限制。

如何只允许一个文件夹中的一个文件处理 POST 请求?

httpd.conf http-headers apache-2.2

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

apache-2.2 ×1

http-headers ×1

httpd.conf ×1