2016-11-29 118 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