开发者

Folder Access Restrictions Apache

开发者 https://www.devze.com 2023-03-03 17:51 出处:网络
I have the following directory structure on my Apache web root. I would like to res开发者_运维知识库trict the \"source\" folder to the outside world. Currently it can be accessed via its url.

I have the following directory structure on my Apache web root.

I would like to res开发者_运维知识库trict the "source" folder to the outside world. Currently it can be accessed via its url.

How can this be done?

Folder Access Restrictions Apache


Put a .htaccess file inside the source folder:

order allow deny
deny from all


chmod -R o-rwx source

this will remove permissions for the outside world to the directory source and all of its content


You can also put an index.html file in each directory with a forbidden access notice as index.html is the default default file to be viewed when opening a directory.


You could make it seem like the directory doesn't exist by inserting index.php and writing

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

精彩评论

暂无评论...
验证码 换一张
取 消