Magento url redirect from a Controller
Posted on June 18, 2016, 3:25 pm, by admin, under
Magento 2.0.
<?php
namespace Imran\Test\Controller\Index;
use \Magento\Framework\App\Action\Action;
class Index extends Action
{
/**
* @var \Magento\Framework\View\Result\Page
*/
protected $resultPageFactory;
/**
* @param \Magento\Framework\App\Action\Context $context
*/
public function __construct(\Magento\Framework\App\Action\Context $context,
\Magento\Framework\View\Result\PageFactory $resultPageFactory)
{
parent::__construct($context);
$this->resultPageFactory = $resultPageFactory;
$this->resultRedirectFactory->create()->setUrl('https://www.someurl.com');
}
} |