Create di.xml and add the below code
Magemonkey/Redirect/etc/frontend/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoCustomerControllerAccountLoginPost">
<plugin name="redirect_custom_url" type="MagemonkeyRedirectPluginRedirectCustomUrl" sortOrder="1" />
</type>
</config>
Create the plugin
Magemonkey/Redirect/Plugin/RedirectCustomUrl.php
<?php
namespace MagemonkeyRedirectPlugin;
class RedirectCustomUrl
{
public function __construct(
MagentoStoreModelStoreManagerInterface $storeManager,
MagentoFrameworkAppHttpContext $authContext,
MagentoFrameworkAppResponseRedirectInterface $redirect,
MagentoFrameworkAppRequestInterface $request
){
$this->storeManager = $storeManager;
$this->authContext = $authContext;
$this->redirect = $redirect;
$this->_request = $request;
}
public function afterExecute(MagentoCustomerControllerAccountLoginPost $subject,$result)
{
$currentWebsiteId = $this->storeManager->getStore()->getWebsiteId();
$isLoggedIn = $this->authContext->getValue(MagentoCustomerModelContext::CONTEXT_AUTH);
if ($isLoggedIn){
$customUrl = 'customurl.html';
$result->setPath($customUrl);
}
return $result;
}
}

