我做了很多研究,但我仍然找不到解决问题的方法。有一个网站,由于某种原因,可以很容易地显示他的内容,如果你访问这样的路径:
domain.com/templates/orange/forums/sections/forum_item.php
我不知道如何隐藏所有/模板目录从查看。这个网站很奇怪,通常所有现代系统都有我需要的默认配置功能,但这个没有。我试图做一个。htaccess重定向/模板,但显然网站设计已经停止工作请建议。
我喜欢把我不想直接访问的代码放在document root
和子目录之外。例如,如果您有以下设置:
index.php
|_templates/
|_home.php
|_about.php
|_contact.php
|_models/
|_home.php
|_about.php
|_contact.php
我改成这样:
|_public_html
|_index.php
|_templates/
|_home.php
|_about.php
|_contact.php
|_models/
|_home.php
|_about.php
|_contact.php
在这种情况下,apache配置的文档根不需要更改,但是您需要更改包含路径。在index。php中可以这样写:
<?php
include '../models/about.php';
include ../templates/about.php