Redirecting to another website using Redirect::to() Redirecting to another website using Redirect::to() laravel laravel

Redirecting to another website using Redirect::to()


You need to provide fully qualifying URL to Redirect::to() method, otherwise application base URL is prepended.

$url = 'www.google.com';// redirects to http://localhost:8888/www.google.comreturn Redirect::to($url);$url = 'http://google.com';// redirects to http://google.comreturn Redirect::to($url);


To redirect to an external domain, use a fully qualified url such as tiqeet.com

in your controller, call a return Redirect::intended("your fully qualified domain");

hope it works for you. Used it in laravel 4.0


Route::get('/', function () {  $url = 'YOUR DOMAIN NAME HERE';  //DOMAIN NAME MUST BE LIKE THIS : https://www.google.com/  return Redirect::to($url);});

In I'm using Laravel 5.5 only for API's so in web route file i redirected to my domain name if any one tried to open the API domain name its redirected to my same domain