We sacrifice by not doing any other technology, so that you get the best of Magento.

We sacrifice by not doing any other technology, so that you get the best of Magento.

    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;
        }
    }

     

    Fill the below form if you need any Magento relate help/advise/consulting.

    With Only Agency that provides a 24/7 emergency support.

      Get a Free Quote