[英]Uploading Laravel from my localhost to godaddy server
我在localhost中設置的效果很好。 我想將我的Laravel應用上傳到我的GoDaddy服務器。 我創建了一個FTP,以將Laravel應用程序傳輸到GoDaddy服務器。 正如我在創建FTP帳戶時注意到的那樣,文件位於/ webroot內部,因此我在/webroot/testapp
內部創建的/webroot/testapp
testapp
是我的Laravel應用。 在Laravel應用程序內部,有一個公用文件夾。 正如我在Google上進行的研究所得出的那樣,其他人說,僅公共文件夾內必須在/public_html
而Laravel應用將在外部。 就我而言,它是/webroot
。 現在,將Laravel應用程序傳輸到服務器后,我沒有分離公用文件夾。 我也將其放在testapp
文件夾中,因為當我將公用文件夾放在testapp
文件夾之外並編輯index.php文件時,我的主站點位於WordPress中,這將導致錯誤。 因此,我將公用文件夾添加到了我的testapp
文件夾中。 當我嘗試在瀏覽器中運行時,提示“ 404(找不到頁面)”,因此我嘗試在下面編輯index.php文件
<?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @author Taylor Otwell <taylor@laravel.com>
*/
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| our application. We just need to utilize it! We'll simply require it
| into the script here so that we don't have to worry about manual
| loading any of our classes later on. It feels great to relax.
|
*/
require __DIR__.'/../testapp/public/bootstrap/autoload.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__.'/../testapp/public/bootstrap/app.php';
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request
| through the kernel, and send the associated response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
$response->send();
$kernel->terminate($request, $response);
現在有人可以幫我解決這個問題嗎? 我看過其他教程都很好,我的不是。 非常感謝任何幫助。 TIA
您應該將整個項目從localhost上傳到godaddy,然后要求支持團隊編輯指向公共文件夾的主機。
這是一項共享的托管服務,因此您不能一個人做。 問一下。
在根目錄中創建Crete .htaccess並添加以下代碼:-
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
</IfModule>
希望能幫助到你!
遵循本教程,它適用於任何共享主機計划。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.