Forward a request using a Factory object in Magento
Learn how to use Magento ForwardFactory to forward controller actions without changing the URL in your custom module.
Lesson Content
We just learned about redirects, but noticed how the URL changed from /blog to /blog/post/list. Sometimes this is desired, sometimes it isn’t. For our blog, we actually don’t want to redirect the URL to another location, but rather just forward the request behind the scenes to another controller action.
Luckily, there is another option we can use called a Forward.
Let’s replace the RedirectFactory with ForwardFactory, also from Magento\Framework\Controller\Result.
We’ll update our property name, and also the references to redirectFactory with forwardFactory, and also upd...
Join the discussion!
Comments
Want to comment on this lesson?
Enroll in this course to leave comments.