Video Lesson: Forward a request using a Factory object in Magento

Forward a request using a Factory object in Magento

This is premium content

Only available to enrolled or University students.
Join today to unlock all lessons in this course.

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...

Premium content

Enroll to unlock the full content and all course materials.

Maggie

Hey, I'm Maggie! 👋

Ask me anything.

Want to chat with Maggie?

Enroll in this course for AI tutor access.

Comments

Join the discussion!

Comments

Want to comment on this lesson?

Enroll in this course to leave comments.