Magento 2 redirect to external URL from controller
0
I want to redirect to a external URL in my controller but not in the execute() function. This code works fine and the result is a redirect to google: public function execute() { $resultRedirect = $this->resultRedirectFactory->create(); if ($this->session->isLoggedIn()) { $resultRedirect->setUrl('https://www.google.co.uk'); return $resultRedirect; } ) However, this code is not working: public function execute() { $this->testRedirect(); ) public function testRedirect(){ $resultRedirect = $this->resultRedirectFactory->create(); if ($this->session->isLoggedIn()) { $resultRedirect->setUrl('https://www.google.co.uk'); return $resultRedirect; } } This code doesn't redirect and...