将PHP应用程序文件夹放在public_html之上 [英] Placing the PHP application folder above public_html
问题描述
- root
- app
- application_folder
- 配置
- 控制器
- >
- public_html
- css
- js
-
- 图片
- index.php
- .htaccess
- app
编辑:
如果服务器遭到黑客攻击,这是否有任何影响?
这个想法是只有应该能够用户访问的内容将被放置在 public_html
中,以便互联网上的随机人员无法访问您的代码或数据的随机片段,如果他们猜测正确的URL。
通常的方法是在应用程序内部有一个公用文件夹,然后将其符号链接到public_html或以下,而不是将应用程序实际分为两部分。
I saw in a thread and seen in some frameworks, that using the below structure is recommended. Can someone please explain why, in terms of security (if you can explain it thoroughly would be appreciated)? Are there any other advantages of this?
- root
- app
- application_folder
- config
- controllers
- models
- public_html
- css
- js
- images
- index.php
- .htaccess
- app
EDIT:
Does this have any effect if the server was hacked?
The idea is that only the things that should be able to be accessed by the user are placed in public_html
, so that random people on the Internet can't access random pieces of your code or data if they guess the right URL.
The usual way this is done is to have a public folder inside the app which is then symlinked to public_html or under, and not actually split the application in two parts.
这篇关于将PHP应用程序文件夹放在public_html之上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!