我有一个文件夹,其中包含各种文件夹中的HTML,CSS,JS,图像文件。出于安全原因,我想将它放在Web根目录之外。从外部web根目录在Apache服务器上运行一个Html文件
我遇到了使用PHP的file_get_contents
函数的解决方案。
但是,在页面中存在超链接存在问题。例如,链接到JavaScript文件中的页面:在http://localhost/lms/APIConstants.js
<script src="lms/APIConstants.js" type="text/javascript"></script>
搜索文件,并返回
Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost/lms/APIConstants.js
错误我知道使用.htaccess文件的隐藏一些文件夹从web根目录。我正在寻找其他有见解的解决方案。
然后让它成为一个完整的url – 2014-11-05 06:29:27
这可能会帮助你http://stackoverflow.com/questions/13550471/php-include-file-in-webroot-from-file-outside-webroot – Chella 2014-11-05 06:33:56
我不能那样做,这个HTML,CSS,JS文件是自动生成的。 – Aniruddha 2014-11-05 06:34:03