How to Redirect to External URL in Laravel?

By Hardik Savani November 21, 2022 Category : Laravel

Hello Artisan,

In this guide, we are going to learn laravel redirect external url. In this article, we will implement a laravel redirect()->away. This post will give you a simple example of laravel redirect to external url from controller. I explained simply about laravel redirect to external link. Alright, let us dive into the details.

Sometimes you may need to redirect on external URL from our laravel application like if you use something like Amazon API, Paypal API etc. so, Laravel provide away() for redirect other external link for return redirect like bellow example:

Example:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class DemoController extends Controller

{

/**

* Write code on Method

*

* @return response()

*/

public function index(Request $request)

{

return redirect()->away('https://www.itsolutionstuff.com');

}

}

I hope it can help you...

Tags :