我有一個文件夾,其中包含各種文件夾中的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