cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2 - Redirect to external url with parameters from Controller

Magento 2 - Redirect to external url with parameters from Controller

I am using the below code for a POST request.

$params = array(
'token'=> $hello["token"]
);
$this->_redirectUrl($url,$params);

But the redirect is not happening.

Can anyone help me with this?

Thanks in advance.

 

3 REPLIES 3

Re: Magento 2 - Redirect to external url with parameters from Controller

Hello @gdhar67 

Use _redirect function instead of redirectUrl

$params = array(
'token'=> $hello["token"]
);
$this->_redirect($url,$params);

If my answer is useful click Kudos and Accept as Solution

 

Re: Magento 2 - Redirect to external url with parameters from Controller

I already tried that it didn't work

Re: Magento 2 - Redirect to external url with parameters from Controller

Hello @gdhar67 

For adding parameters on your url use simple php code from here

and after that use 

redirectUrl function as before

 

If my answer is useful click kudos and Accept as Solution