dqz84361326 2014-05-11 17:31 采纳率: 0%
浏览 305
已采纳

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-11 17: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条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部