【发布时间】:2018-04-20 16:57:47
【问题描述】:
我想部署一个 laravel 项目,但是当我单击某个链接/路由时,我一直收到内部服务器错误 500。我坚信这是.htaccess 文件。默认文件看起来像这样,我不知道我需要如何修改它。
在我的 ftp 服务器上,我这样设置:
网络空间已连接到 /raidsystem/public_html/
.htaccess 位于 _public_html_ 中,另一个文件夹名为“lsapp”,位于 /raidsystem/ 中,因此如下所示:
/raidsystem/lsapp/
/raidsystem/public_html/.htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
【问题讨论】:
-
在公共目录中显示
index文件的代码。以及你的服务器的目录结构 -
<?php define('LARAVEL_START', microtime(true)); require __DIR__.'/lsapp/vendor/autoload.php'; $app = require_once __DIR__.'/lsapp/bootstrap/app.php'; $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); $response = $kernel->handle( $request = Illuminate\Http\Request::capture() ); $response->send(); $kernel->terminate($request, $response); -
raidsystem/lsapp/vendor/autoload.php -
raidsystem/public_html/index.phpraidsystem/public_html/.htaccessWebspace 已连接到 public_html
标签: php laravel .htaccess deployment