2016-11-29 119 views
0

我的服务器使用cPanel。目录结构在这里如何在Laravel中更改默认路径'/ public'名称

  • laravel项目
  • public_ftp
  • 的public_html
    • 公共
      • 的index.php

我下面的这个家伙在服务器上部署 https://github.com/petehouston/laravel-deploy-on-shared-hosting

一切都很好,但我的基本路径是“mydomain.com/public” 我不想从我的路径中删除/公开出来,但要改变它, 我想这样的路径 “mydomain.com/noticed”

我使用laravel版本5.3

任何想法? 谢谢

回答

0

It was suggested在您的公用文件夹中更改index.php

* 
|-------------------------------------------------------------------------- 
| Turn On The Lights 
|-------------------------------------------------------------------------- 
| 
| We need to illuminate PHP development, so let us turn on the lights. 
| This bootstraps the framework and gets it ready for use, then it 
| will load up this application so that we can run it and send 
| the responses back to the browser and delight our users. 
| 
*/ 

$app = require_once __DIR__.'/../bootstrap/app.php'; 

// set the public path to this directory 
$app->bind('path.public', function() { 
    return __DIR__; 
}); 

现在你不需要改变你的公共路径时,您的公共 目录已经更改。

Elixir有一个硬编码的公共路径!不要忘记在Elixir配置中设置已更改的 公共路径。

我想补充一点,您还需要确保您的新公共路径与默认路径具有相同的权限。您可能还想更改config/filesystem.php中的公共路径。

+0

我使用asset()来包含来自js/css的源代码,然后全部消失。 我跟随此http://stackoverflow.com/a/29716810/5071013 和更改资产()elixir()仍然不工作 – GaoEy

+1

哦,我有我的XAMMP pourblem但生产工作仍然可以谢谢:D – GaoEy