Video Lesson: Redirect a controller action using a factory in Magento

Redirect a controller action using a factory in Magento

This is premium content

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

Redirect a controller action using a factory in Magento

Magento 2 redirect controller tutorial using RedirectFactory to route blog to blog post list.

Lesson Content

At the moment, we need to visit /blog/post/list to get our blog post list action, which will eventually be used to display all blog posts. It would be nice to set up the /blog URL to display these blog posts though, as that is a good entry point to our blog that we can link to and is easier to type.

We already have an Index.php file returning a die response for this controller.

<?php

declare(strict_types=1);

namespace Macademy\Blog\Controller\Index;

use Magento\Framework\App\Action\HttpGetActionInterface;

clas...

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.