2014-12-06 125 views
1

首先啓動我是laravel的新手,當出現錯誤的頁面時,出現500內部服務器錯誤,而不是404。在我剛剛將框架安裝到我的項目後,一切進展順利,直到我完成了一些我不確定的事情後,這個錯誤突然開始了。我去laravel的錯誤日誌中storage/logs/laravel.log,這就是我得到:laravel php獲取500而不是404

[2014-12-06 10:28:29] production.ERROR: exception 'InvalidArgumentException' with message 'View [calc/finance/credite] not found.' in /home/jasha/proj/cpcalculateinc/htmlbackup/html/bootstrap/compiled.php:9431 
Stack trace: 
#0 /home/jasha/proj/cpcalculateinc/htmlbackup/html/bootstrap/compiled.php(9404): Illuminate\View\FileViewFinder->findInPaths('calc/finance/cr...', Array) 
#1 /home/jasha/proj/cpcalculateinc/htmlbackup/html/vendor/laravel/framework/src/Illuminate/View/Factory.php(124): Illuminate\View\FileViewFinder->find('calc/finance/cr...') 
#2 /home/jasha/proj/cpcalculateinc/htmlbackup/html/bootstrap/compiled.php(3238): Illuminate\View\Factory->make('calc/finance/cr...') 
#3 /home/jasha/proj/cpcalculateinc/htmlbackup/html/app/routes.php(30): Illuminate\Support\Facades\Facade::__callStatic('make', Array) 
#4 /home/jasha/proj/cpcalculateinc/htmlbackup/html/app/routes.php(30): Illuminate\Support\Facades\View::make('calc/finance/cr...') 
#5 [internal function]: {closure}('finance', 'credite') 
#6 /home/jasha/proj/cpcalculateinc/htmlbackup/html/bootstrap/compiled.php(5331): call_user_func_array(Object(Closure), Array) 
#7 /home/jasha/proj/cpcalculateinc/htmlbackup/html/bootstrap/compiled.php(4998): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request)) 
#8 /home/jasha/proj/cpcalculateinc/htmlbackup/html/bootstrap/compiled.php(4986): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request)) 
#9 /home/jasha/proj/cpcalculateinc/htmlbackup/html/bootstrap/compiled.php(715): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request)) 
#10 /home/jasha/proj/cpcalculateinc/htmlbackup/html/bootstrap/compiled.php(696): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request)) 
#11 /home/jasha/proj/cpcalculateinc/htmlbackup/html/bootstrap/compiled.php(7746): Illuminate\Foundation\Application->handle(Object(Illuminate\Http\Request), 1, true) 
#12 /home/jasha/proj/cpcalculateinc/htmlbackup/html/bootstrap/compiled.php(8353): Illuminate\Session\Middleware->handle(Object(Illuminate\Http\Request), 1, true) 
#13 /home/jasha/proj/cpcalculateinc/htmlbackup/html/bootstrap/compiled.php(8300): Illuminate\Cookie\Queue->handle(Object(Illuminate\Http\Request), 1, true) 
#14 /home/jasha/proj/cpcalculateinc/htmlbackup/html/bootstrap/compiled.php(10962): Illuminate\Cookie\Guard->handle(Object(Illuminate\Http\Request), 1, true) 
#15 /home/jasha/proj/cpcalculateinc/htmlbackup/html/bootstrap/compiled.php(657): Stack\StackedHttpKernel->handle(Object(Illuminate\Http\Request)) 
#16 /home/jasha/proj/cpcalculateinc/htmlbackup/public_html/index.php(49): Illuminate\Foundation\Application->run() 
#17 {main} [] [] 

我應該從哪裏開始尋找解決這個問題?

UPDATE

AddOutputFilterByType DEFLATE text/plain 
AddOutputFilterByType DEFLATE text/html 
AddOutputFilterByType DEFLATE text/xml 
AddOutputFilterByType DEFLATE text/css 
AddOutputFilterByType DEFLATE application/xml 
AddOutputFilterByType DEFLATE application/xhtml+xml 
AddOutputFilterByType DEFLATE application/rss+xml 
AddOutputFilterByType DEFLATE application/javascript 
AddOutputFilterByType DEFLATE application/x-javascript 
## EXPIRES CACHING ## 
<IfModule mod_expires.c> 
ExpiresActive On 
ExpiresByType image/jpg "access 1 minute" 
ExpiresByType image/jpeg "access 1 minute" 
ExpiresByType image/gif "access 1 minute" 
ExpiresByType image/png "access 1 minute" 
ExpiresByType text/css "access 1 minute" 
ExpiresByType text/html "access 1 minute" 
ExpiresByType application/pdf "access 1 minute" 
ExpiresByType text/x-javascript "access 1 minute" 
ExpiresByType application/x-shockwave-flash "access 1 minute" 
ExpiresByType image/x-icon "access 1 minute" 
ExpiresDefault "access 1 minute" 
</IfModule> 
## EXPIRES CACHING ## 
<IfModule mod_rewrite.c> 
    <IfModule mod_negotiation.c> 
     Options -MultiViews 
    </IfModule> 

    RewriteEngine On 

    # Redirect Trailing Slashes... 
    RewriteRule ^(.*)/$ /$1 [L,R=301] 

    # Handle Front Controller... 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteRule^index.php [L] 

RewriteCond %{REQUEST_FILENAME} !^(.+)\.woff$ 
RewriteCond %{REQUEST_FILENAME} !^(.+)\.ttf$ 
RewriteCond %{REQUEST_FILENAME} !^(.+)\.otf$ 
RewriteCond %{REQUEST_FILENAME} !^(.+)\.svg$ 
RewriteCond %{REQUEST_FILENAME} !^(.+)\.eot$ 
</IfModule> 
+0

這不是'404',但內部錯誤由於拋出異常。這是'視圖'丟失,所以創建它或更改路線/控制器使用另一個。 – 2014-12-06 10:40:44

+0

@JarekTkaczyk是的,但這是404錯誤處理的目的,當你輸入錯誤的網址時,它應該將你重定向到404頁面,而不是我得到500 – user3135757 2014-12-06 10:46:36

+0

再次,這不是'頁面未找到404',但拋出異常應用程序,即。 '500內部錯誤',由於代碼中的錯誤。閱讀有關錯誤處理的信息,您可以在其中定義在發生任何異常時發生的情況(如果您喜歡,可以顯示「404」):http://laravel.com/docs/4.2/errors#handling-errors – 2014-12-06 10:54:09

回答

2

有沒有默認的404頁或模板,它只是拋出一個標準的HTTP異常錯誤頁面。

Laravel.com美國官方的文檔,如果您的應用程序::缺少的配置,因爲它是描述

您可以註冊處理所有的「404未找到」 錯誤的錯誤處理程序以下約404檢查在您的應用程序,讓您輕鬆定製返回404個 錯誤頁面:

App::missing(function($exception) 
{ 
return Response::view('errors.missing', array(), 404); 
});