Redirecting to another site using Redirect :: to ()

When I use Redirect::to($url) , this is the result:

 http://localhost/http://mysite.com/foo/bar.html 

But when I use Redirect::to('http://google.com') , it approaches Google just fine, can I assume that my problem?

+4
source share
2 answers

You need to provide a fully qualified URL for the Redirect::to() method, otherwise the application URL is added.

 $url = 'www.google.com'; // redirects to http://localhost:8888/www.google.com return Redirect::to($url); $url = 'http://google.com'; // redirects to http://google.com return Redirect::to($url); 
+8
source

To redirect to an external domain, use the full URL, for example tiqeet.com

in your controller, call return Redirect :: intended ("your full domain");

hope this works for you. Used in laravel 4.0

+2
source

Source: https://habr.com/ru/post/1500444/


All Articles