Error

We're sorry, but an unhandled error occurred. Please see the details below.

Cannot modify header information - headers already sent by (output started at /home/site/wwwroot/plugins/businessbecause/news/controllers/http/controllers/News.php:616)

~/plugins/businessbecause/news/components/Article.php line 118

        if($crumbs[1] !== 'news'){//url = home/:slug
 
            $crumbs = explode("/",$_SERVER["REQUEST_URI"]);
            if(isset($crumbs[3])){
                $slug = newsPost::check_article_exists($crumbs[3]);#check article record exists 
                if ($slug == 1) {
                    header("HTTP/1.1 301 Moved Permanently"); #redirect 
                    return redirect('news/'.$crumbs[1].'/'.$crumbs[2].'/'.$crumbs[3],301);
                } else{
                    return redirect('404');//#article record doesn't exists
                }
            }
            else return redirect('404');//#article record doesn't exists

Stack trace

# Called Code Document Line
37 header() ~/plugins/businessbecause/news/components/Article.php 118
36 Businessbecause\News\Components\Article->onRun() ~/modules/cms/classes/CmsCompoundObject.php 179
35 Cms\Classes\CmsCompoundObject->runComponents() ~/modules/cms/classes/Controller.php 501
34 Cms\Classes\Controller->execPageCycle() ~/modules/cms/classes/Controller.php 389
33 Cms\Classes\Controller->runPage() ~/modules/cms/classes/Controller.php 222
32 Cms\Classes\Controller->run() ~/modules/cms/classes/CmsController.php 50
31 Cms\Classes\CmsController->run() ~/vendor/laravel/framework/src/Illuminate/Routing/Controller.php 54
30 Illuminate\Routing\Controller->callAction() ~/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php 45
29 Illuminate\Routing\ControllerDispatcher->dispatch() ~/vendor/laravel/framework/src/Illuminate/Routing/Route.php 219
28 Illuminate\Routing\Route->runController() ~/vendor/laravel/framework/src/Illuminate/Routing/Route.php 176
27 Illuminate\Routing\Route->run() ~/vendor/laravel/framework/src/Illuminate/Routing/Router.php 681
26 Illuminate\Routing\Router->Illuminate\Routing\{closure}() ~/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php 130
25 Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() ~/plugins/rainlab/translate/classes/LocaleMiddleware.php 29
24 RainLab\Translate\Classes\LocaleMiddleware->handle() ~/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php 171
23 Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() ~/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php 41
22 Illuminate\Routing\Middleware\SubstituteBindings->handle() ~/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php 171
21 Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() ~/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php 49
20 Illuminate\View\Middleware\ShareErrorsFromSession->handle() ~/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php 171
19 Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() ~/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php 56
18 Illuminate\Session\Middleware\StartSession->handle() ~/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php 171
17 Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() ~/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php 37
16 Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle() ~/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php 171
15 Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() ~/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php 67
14 Illuminate\Cookie\Middleware\EncryptCookies->handle() ~/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php 171
13 Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() ~/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php 105
12 Illuminate\Pipeline\Pipeline->then() ~/vendor/laravel/framework/src/Illuminate/Routing/Router.php 683
11 Illuminate\Routing\Router->runRouteWithinStack() ~/vendor/laravel/framework/src/Illuminate/Routing/Router.php 658
10 Illuminate\Routing\Router->runRoute() ~/vendor/laravel/framework/src/Illuminate/Routing/Router.php 624
9 Illuminate\Routing\Router->dispatchToRoute() ~/vendor/october/rain/src/Router/CoreRouter.php 31
8 October\Rain\Router\CoreRouter->dispatch() ~/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php 170
7 Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}() ~/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php 130
6 Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() ~/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php 63
5 Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle() ~/vendor/october/rain/src/Foundation/Http/Middleware/CheckForMaintenanceMode.php 23
4 October\Rain\Foundation\Http\Middleware\CheckForMaintenanceMode->handle() ~/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php 171
3 Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() ~/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php 105
2 Illuminate\Pipeline\Pipeline->then() ~/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php 145
1 Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter() ~/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php 110
0 Illuminate\Foundation\Http\Kernel->handle() ~/index.php 43