3 回答

TA貢獻(xiàn)1934條經(jīng)驗(yàn) 獲得超2個(gè)贊
所以我想出了怎么做。我將舉例說明。
假設(shè)您是一個(gè)域,http://domain.com。這是您可能正在使用的結(jié)構(gòu)的示例:
domain.com/ (the root of your web hosting)
|-- yourlaravel4_base/
|-- [some other folders...]
|-- public_html/ (where your html files and such go)
| |-- [some other folders...]
| |-- yourlaravel4/
/public_html/是您的網(wǎng)絡(luò)托管文件可公開訪問的部分的根。您要在中創(chuàng)建一個(gè)子文件夾/public_html/(在這種情況下/public_html/yourlaravel4/)。在此子文件夾中,您將存儲(chǔ)Laravel 4 文件夾的所有內(nèi)容public/。
現(xiàn)在,剩下的文件。您必須轉(zhuǎn)到網(wǎng)絡(luò)托管文件的根目錄,也就是說,您想要處于domain.com/級(jí)別,因此能夠查看public_html/和其他文件夾。然后,我們需要在此處創(chuàng)建一個(gè)文件夾,該文件夾將存儲(chǔ)Laravel 4的基本文件。在這種情況下為domain.com/yourlaravel4_base/。在內(nèi)部,yourlaravel4_base/我們需要存儲(chǔ)基本Laravel 4目錄中存在的每個(gè)文件和文件夾。這將是app/,bootstrap/,vendor/,server.php,等一切EXCEPT /public/文件夾,其內(nèi)容你已經(jīng)存儲(chǔ)在public_html/yourlaravel4/。
最后,我們需要編輯2個(gè)文件:Laravel /bootstrap/paths.php和/public/index.php。
在paths.php文件中,替換為:
'app' => __DIR__.'/../app',
與:
'app' => __DIR__.'/../../yourlaravel4_base/app',
在paths.php文件中,替換為:
'public' => __DIR__.'/../public',
與:
'public' => __DIR__,
在paths.php文件中,替換為:
'base' => __DIR__.'/..',
與:
'base' => __DIR__.'/../../yourlaravel4_base',
在中paths.php,替換:
'storage' => __DIR__.'/../app/storage',
與:
'storage' => __DIR__.'/../../yourlaravel4_base/app/storage',
在中index.php,替換:
require __DIR__.'/../bootstrap/autoload.php';
與:
require __DIR__.'/../../yourlaravel4_base/bootstrap/autoload.php';
在中index.php,替換:
$app = require_once __DIR__.'/../bootstrap/start.php';
與:
$app = require_once __DIR__.'/../../yourlaravel4_base/bootstrap/start.php';
上傳更改?,F(xiàn)在,您應(yīng)該可以在網(wǎng)站的子文件夾中安裝Laravel 4,而無需實(shí)際暴露app/文件夾和其他敏感文件。:)

TA貢獻(xiàn)1966條經(jīng)驗(yàn) 獲得超4個(gè)贊
人,人!無需過于復(fù)雜!
(對于其他公用文件夾,例如,htdocs
或www
僅將public_html
以下內(nèi)容替換為您的公用文件夾。)
將所有Laravel內(nèi)容放入頂層文件夾(以便該
app
文件夾位于該文件夾旁邊public_html
)將所有文件從
public
移到public_html
(確保還移走隱藏文件,例如.htaccess
?。?/p>刪除現(xiàn)在為空的
public
文件夾在
bootstrap/path.php
改變'public' => __DIR__.'/../public',
至'public' => __DIR__.'/../public_html',
做完了
添加回答
舉報(bào)