dqz84361326 2014-05-12 01:31 采纳率: 0%
浏览 303
已采纳

Laravel 4:阻止访问除public之外的任何文件或文件夹

I'm working on small project, and will host it on normal Godaddy host plan, the problem is: all file system will be accessible through internet.

so, how can I prevent access to any folder or file except /public

CONTRIBUTING.md  
app/     
artisan  
bootstrap/   
composer.json    
composer.lock    
phpunit.xml  
public/  
server.php   
vendor/

thanks,

  • 写回答

2条回答 默认 最新

  • dongqishou7471 2014-05-12 01:40
    关注

    Why not split the project up? Upload the contents of public to your document root and the rest somewhere else (like your home directory). Then just modify the two paths in the public/index.php file to point to the right locations, eg

    $path = __DIR__ . '/../my-app';
    
    require $path . '/bootstrap/autoload.php';
    
    $app = require_once $path . '/bootstrap/start.php';
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?