【发布时间】:2018-09-24 06:52:16
【问题描述】:
我在 localhost 中的设置运行良好。我想将我的 Laravel 应用程序上传到我的 GoDaddy 服务器。我创建了一个 FTP 来将我的 Laravel 应用程序传输到我的 GoDaddy 服务器。正如我在创建 FTP 帐户时注意到的那样,文件位于 /webroot 内,所以我在 testapp 内创建了一个 /webroot/testapp 是我的 Laravel 应用程序。在 Laravel 应用程序中,有一个公用文件夹。正如我在谷歌中研究的那样,只有公用文件夹必须在 /public_html 内,而 Laravel 应用程序将在外面。就我而言,它是/webroot。现在将我的 Laravel 应用程序传输到我的服务器后,我没有分离我的公用文件夹。我也将它放在testapp 文件夹中,因为当我将公用文件夹放在我的testapp 文件夹之外并编辑 index.php 文件时,我的主站点位于 WordPress 中,它会导致错误。所以我将公用文件夹添加到我的testapp 文件夹中。当我尝试在浏览器中运行时,它显示 404 (Page Not Found) Error` 所以我尝试在下面编辑我的 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
【问题讨论】:
-
你试过yourwebsite.com/public ..检查它是否工作然后我会给你htaccess代码使它成为root
-
我试过你的答案,但它会重定向到我的主站点
-
如果对你有帮助,请看我的回答