配置 Apache 以隐藏 .json 类型的文件

Lal*_*h B 2 webserver apache2 mime-types

我在 apache 的 DocumentRoot 上有一些 .json 类型的文件。当公共查看者使用 URL 访问时,我需要隐藏或不允许向他们显示这些文件。http://somehostname/somefile.json,如何禁用不显示这些文件的选项。

neo*_*neo 5

复制 .ht 文件的规则,您可以将以下行添加到您的 httpd.conf

<Files ~ "\.json$">
 Order allow,deny
 Deny from all   
 Satisfy All     
</Files>
Run Code Online (Sandbox Code Playgroud)