Laravel5: Redirect :: to () outside the NotFoundHttpException link in RouteCollection.php

I am developing a Laravel 5 application, I have this route

Route::get('/go','UrlController@index');

and in this UrlController.php, I have this index method

public function index(){
    return Redirect::to('www.google.com',302);
}

when I check this URL http://localhost:8000/go  it just changes to http://localhost:8000/www.google.comand has this error NotFoundHttpException in RouteCollection.php line 161 so the problem is, thanks

+4
source share
1 answer

you must add the protocol before www.google.com

public function index(){
    return Redirect::to('https://www.google.com',302);
}
+3
source

Source: https://habr.com/ru/post/1649368/


All Articles