Laravel 8 How to Redirect Route with Query String Params

Reading Time: 3 minutes

Inside this article we will see the concept of route redirection from one location to other location with query string values.

query string is a part of a uniform resource locator (URL) that assigns values to specified parameters. A query string commonly includes fields added to a base URL by a Web browser or other client application

This tutorial will be very easy to understand this small concept. We will discuss Laravel 8 How to redirect route with query string parameters.

Learn More –


Query String values

Let’s get started.

Laravel Installation

We will create laravel project using composer. So, please make sure your system should have composer installed. If not, may be this article will help you to Install composer in system.

Here is the command to create a laravel project-

composer create-project --prefer-dist laravel/laravel blog

To start the development server of Laravel –

php artisan serve


Assuming laravel already installed inside your system.

Add Routes

Open web.php file from /routes folder. Add these routes into it.


Route::get("call-me", [SiteController::class, "fromRoute"])->name("call.from");
Route::get("call-to", [SiteController::class, "toRoute"])->name("");


Create Controller

Open project into terminal and run this artisan command.

$ php artisan make:controller SiteController

It will create SiteController.php file inside /app/Http/Controllers folder.

Open SiteController.php and add your route redirection logic.


namespace App\Http\Controllers;

use Illuminate\Http\Request;

class SiteController extends Controller
    public function fromRoute()
        return redirect()->route('', ['name' => 'Ashish', 'age' => '28']);

    public function toRoute(Request $request)
        // Get all query string parameters

This line of code helps to redirect()->route(‘’, [‘name’ => ‘Ashish’, ‘age’ => ’28’]);

Redirect to – named route.

Application Testing

Run this command into project terminal to start development server,

php artisan serve


Automatically it redirects to

We hope this article helped you to learn about Laravel 8 How to Redirect Route with Query String Params Tutorial in a very detailed way.

Online Web Tutor invites you to try Skillshike! Learn CakePHP, Laravel, CodeIgniter, Node Js, MySQL, Authentication, RESTful Web Services, etc into a depth level. Master the Coding Skills to Become an Expert in PHP Web Development. So, Search your favourite course and enroll now.

If you liked this article, then please subscribe to our YouTube Channel for PHP & it’s framework, WordPress, Node Js video tutorials. You can also find us on Twitter and Facebook.

Sanjay KumarHello friends, I am Sanjay Kumar a Web Developer by profession. Additionally I'm also a Blogger, Youtuber by Passion. I founded Online Web Tutor and Skillshike platforms. By using these platforms I am sharing the valuable knowledge of Programming, Tips and Tricks, Programming Standards and more what I have with you all. Read more