0

I'm trying to redirect to an external URL inside my Laravel Controller but it's not redirecting to another page.

I tried using header as well to no avail.

Redirect to external URL with return in laravel

Laravel 5: redirect to an external link outside of localhost/server

This was in my response headers in the network console logs. I saw the external URL there but it was not redirected to.

alt-svc: clear
date: Thu, 04 Oct 2018 17:18:51 GMT
status: 200
strict-transport-security: max-age=31556926; includeSubDomains; preload
via: 1.1 google
x-content-type-options: nosniff
x-xss-protection: 1; mode=block

A private function in the controller is the one used for redirecting.

private function processRedirect($gohere){
        return Redirect::away($gohere);
    }
}
Christian Gallarmin
  • 660
  • 4
  • 15
  • 34
magicianiam
  • 1,474
  • 7
  • 33
  • 70

1 Answers1

1

Make sure $gohere contains the full URL like this:

$gohere = "https://stackoverflow.com";

private function processRedirect($gohere){
        return Redirect::away($gohere);
    }
}
Elisha Senoo
  • 3,489
  • 2
  • 22
  • 29