Magento 2 How to Redirect URL
The following script will help the url to redirect to the particular url you want
<?php
namespace Free\Samaya\Controller\Time;
class Day extends \Magento\Framework\App\Action\Action
{
public function __construct(
PageFactory $resultPageFactory
) {
...................
$this->resultPageFactory = $resultPageFactory;
...................
...................
}
public function execute()
{
/** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */
$redirect = $this->resultRedirectFactory->create();
$redirect->setPath('*/*/');
return $redirect;
}
The following script will help the url to redirect to the particular url you want
<?php
namespace Free\Samaya\Controller\Time;
class Day extends \Magento\Framework\App\Action\Action
{
public function __construct(
PageFactory $resultPageFactory
) {
...................
$this->resultPageFactory = $resultPageFactory;
...................
...................
}
public function execute()
{
/** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */
$redirect = $this->resultRedirectFactory->create();
$redirect->setPath('*/*/');
return $redirect;
}
Comments
Post a Comment