Laravel 5.5 – The Route::redirect method

Laravel 5.5 introduced new Router class method called redirect, which gives the flexibility to redirect to other URLs directly without creating a controller or closure.

How to use Route::redirect()

Let’s define a route with Route::redirect() method, if user tries to access http://localhost:8000/contact page, redirect the user to http://locahost:8000/contact-us page.

The Route::redirect() is very useful method when you want to redirect to a specific URI by accessing another URI.

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

Arjun

I am Arjun from Hyderabad (India). I have been working as a software engineer from last 7+ years, and its my passion to learn new things and implement them as a practice. Aside from work, I likes gardening and spending time with pets.


DMCA.com Protection Status