Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 4: Redirect to a given url

Is there a method in Redirect class of laravel where the parameter is a complete url? We all know parameters to these methods are just route name,action, slash,..etc but what I want now is like

return Redirect::foo('https://bla.com/?yken=KuQxIVTNRctA69VAL6lYMRo0'); 
like image 253
Orvyl Avatar asked Sep 05 '13 01:09

Orvyl


People also ask

How do I redirect in Laravel?

Redirecting to Controller Actions Not only named route but we can also redirect to controller actions. We need to simply pass the controller and name of the action to the action method as shown in the following example. If you want to pass a parameter, you can pass it as the second argument of the action method.

How redirect URL in PHP?

Answer: Use the PHP header() Function You can simply use the PHP header() function to redirect a user to a different page. The PHP code in the following example will redirect the user from the page in which it is placed to the URL http://www.example.com/another-page.php . You can also specify relative URLs.


1 Answers

Yes, it's

use Illuminate\Support\Facades\Redirect;  return Redirect::to('http://heera.it'); 

Check the documentation.

Update: Redirect::away('url') (For external link, Laravel Version 4.19):

public function away($path, $status = 302, $headers = array()) {     return $this->createRedirect($path, $status, $headers); } 
like image 172
The Alpha Avatar answered Sep 24 '22 12:09

The Alpha