I’ve been strugling with this a lot, I have to redirect the users to Home when they login to the site. I’ve been following solutions given in other questions about the same, but nothing works, here are some links I’ve been using:
setBeforeAuthUrl and setAfterAuthUrl
Redirect to product page from observer
Redirect user after login
Magento2: redirection from Observer
All those are rather old and I’m wandering if those answers are deprecated or something, I’m currently working in Magento 2.4.2.
I’m using the observer approach right now, and is not working, I have this configuration:

This is my events.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="customer_login">
<observer name="customer_login_observer" instance="VendorLoginredirectObserverRedirect" />
</event>
</config>
And this is my Observer:
<?php
namespace VendorLoginredirectObserver;
use MagentoFrameworkEventObserver;
use MagentoFrameworkEventObserverInterface;
use MagentoStoreModelStoreManagerInterface;
use MagentoFrameworkObjectManagerInterface;
class Redirect implements ObserverInterface
{
/**
* @var MagentoFrameworkObjectManagerInterface
*/
protected $objectManager;
/**
* @var MagentoStoreModelStoreManagerInterface
*/
protected $storeManagerInterface;
public function __construct(
StoreManagerInterface $storeManagerInterface,
ObjectManagerInterface $objectManager
)
{
$this->storeManagerInterface = $storeManagerInterface;
$this->objectManager = $objectManager;
}
public function execute(Observer $observer)
{
$redirectionUrl = $this->storeManagerInterface->getStore()->getBaseUrl();
$this->objectManager->get('MagentoCustomerModelSession')->setBeforeAuthUrl($redirectionUrl);
}
}
I know the code in the observer is executing because I used some logs to test it, there are no errors in the logs, all appears ok, but if I login as a customer I get to the Account Dashboard anyway.
Is there something I’m overlooking here?