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);
    });
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 seatunnel-web使用SQL组件时候后台报错,无法找到表格
  • ¥15 fpga自动售货机数码管(相关搜索:数字时钟)
  • ¥15 用前端向数据库插入数据,通过debug发现数据能走到后端,但是放行之后就会提示错误
  • ¥15 python天天向上类似问题,但没有清零
  • ¥30 3天&7天&&15天&销量如何统计同一行
  • ¥30 帮我写一段可以读取LD2450数据并计算距离的Arduino代码
  • ¥15 C#调用python代码(python带有库)
  • ¥15 飞机曲面部件如机翼,壁板等具体的孔位模型
  • ¥15 vs2019中数据导出问题
  • ¥20 云服务Linux系统TCP-MSS值修改?