drrog9853 2014-12-06 10:38
浏览 97
已采纳

laravel php获得500而不是404

First to start I am newbie in laravel, I am getting a 500 internal server error instead of 404 when going to the wrong page. well after I have freshly installed the framework to my project everything was going well until I have done something I don't know exactly what can it be, this error suddenly started. i went to the error logs of laravel in storage/logs/laravel.log and this is what I am getting :

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

Where should I start looking to solve this problem ?

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>
  • 写回答

1条回答 默认 最新

  • duanhan9334 2014-12-06 11:13
    关注

    There's no default 404 page or template, it just throws a standard HTTP exception error page.

    The official docs at Laravel.com states the following about 404. Check if your App::missing is configured as it is described

    You may register an error handler that handles all "404 Not Found" errors in your application, allowing you to easily return custom 404 error pages:

    App::missing(function($exception)
    {
    return Response::view('errors.missing', array(), 404);
    });
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法