How to set redirect URL programmatically in magento 2?

In Magento 2, You can set redirect to any link URL by the Magento\Framework\Controller\Result\RedirectFactory Class.

    • Using setUrl($url) -> You need to pass the link as a parameter for redirect
    • Using setPath($path) -> You need to pass path(action URL) as parameter

One Reply to “How to set redirect URL programmatically in magento 2?”

Comments are closed.