简体   繁体   English

文件夹访问限制Apache

[英]Folder Access Restrictions Apache

I have the following directory structure on my Apache web root. 我的Apache网络根目录上具有以下目录结构。

I would like to restrict the "source" folder to the outside world. 我想将“源”文件夹限制在外面。 Currently it can be accessed via its url. 当前可以通过其URL访问它。

How can this be done? 如何才能做到这一点?

索引页

Put a .htaccess file inside the source folder: 将.htaccess文件放在源文件夹中:

order allow deny
deny from all
chmod -R o-rwx source

这将删除外界对目录源及其所有内容的许可

您也可以在每个目录中放置一个index.html文件,并带有禁止访问的通知,因为index.html是打开目录时要查看的默认默认文件。

You could make it seem like the directory doesn't exist by inserting index.php and writing 通过插入index.php并编写,可以使目录看起来不存在

<?php
  header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM