0
我已經安裝了Laravel 5.1並嘗試在共享主機上進行配置。 我已在項目的根和.htaccess文件index.php文件公用文件夾中,但仍然得到:配置Laravel .1 htaccess
500 Internal server Error
我已經運行: composer install
。
我已在.env
文件數據庫配置中添加。
我的項目文件夾名爲cms
。
然後我試圖改變.htaccess file
在public directory
這樣的:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteBase /cms/
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule^index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
.htaccess file
在
project root
是:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
# Options -MultiViews
</IfModule>
RewriteEngine On
RewriteBase /cms/
# RewriteBase /home/crewjobe/public_html/
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule^index.php [L]
# Handle Authorization Header
# RewriteCond %{HTTP:Authorization} .
# RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
我在項目根目錄和公共目錄中都有index.php文件。 公共目錄中的Index.php是從laravel安裝的。在項目的根 index.php文件是:
<?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @author Taylor Otwell <[email protected]>
*/
$uri = urldecode(
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);
//This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here.
if ($uri !== '/' && file_exists(__DIR__.' /public'.$uri)) {
return false;
}
require_once __DIR__.' /public/index.php';
我哪裏錯了?在全新安裝Laravel時是否有一種非常規的配置方式?謝謝。
我從來沒有在.htaccess中看到嵌套的IF ..不知道這是問題,但它看起來很奇怪。推薦的'如果mod_rewrite的」塊 外側移動這個 #選項-MultiViews –
這與laravel安裝時創建在此way..I變化不大的另一部分 –
你怎麼知道這個問題與'.htaccess'有關?錯誤500提示一些PHP錯誤。你在共享主機的'public'或'public_html'目錄中有'error.log'嗎?另外,添加'ini_set('display_errors',1); error_reporting(-1);'到'index.php'並檢查是否有詳細錯誤 –