laravel php获得500而不是404

时间:2014-12-06 10:38:29

标签: php .htaccess laravel

首先开始我是laravel的新手,当我转到错误的页面时,我得到的是500内部服务器错误,而不是404。在我刚刚为我的项目安装了框架之后,一切进展顺利,直到我做了一些我不知道究竟是什么的东西,这个错误突然开始了。我在storage/logs/laravel.log中找到了laravel的错误日志,这就是我得到的:

[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} [] []

我应该从哪里开始寻求解决这个问题?

更新

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>

1 个答案:

答案 0 :(得分:2)

没有默认的404页面或模板,它只会抛出一个标准的HTTP异常错误页面。

Laravel.com的官方文档说明了以下关于404的内容。检查你的App :: missing是否按照描述配置

  

您可以注册一个处理所有“404 Not Found”的错误处理程序   应用程序中的错误,允许您轻松返回自定义404   错误页面:

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