拒绝访问文件

Ale*_*lex 1 php .htaccess

如果我将.ini文件放在我的站点根目录中,任何人只需访问就可以看到它

http://site.com/file.ini

我可以以某种方式限制对该文件的公共访问(htaccess可能吗?),但仍然可以通过我的脚本访问它?

Rya*_*yan 6

将其添加到.htaccess文件中:

<files file.ini>
  order deny,allow
  deny from all
</files>
Run Code Online (Sandbox Code Playgroud)

查看文档.