Need to see customer account at the first before home page. used redirect from the admin panel but not working. Still, when I load my site it goes to the home page.

Mean that see customer account login instead of the home page.

  • did you reindex and recache your website after the changes as your system config are cached Aug 19, 2019 at 7:00
  • Yes i am, but still shoes home page
    – MGPM
    Aug 19, 2019 at 7:07
  • In your admin under the system config. id suggest you changing all store views to make sure that the config is still is the same for each view Aug 19, 2019 at 7:09

1 Answer 1



<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Vendor_Module" setup_version="1.0.0">





<?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="\Magento\Customer\Controller\Account\LoginPost">
        <plugin name="vendor_module_loginpostplugin" type="\Vendor\Module\Plugin\LoginPostPlugin" sortOrder="1" />


 namespace Vendor\Module\Plugin;

class LoginPostPlugin

     * @param \Magento\Customer\Controller\Account\LoginPost $subject
     * @param \Magento\Framework\Controller\Result\Redirect $result
    public function afterExecute(
        \Magento\Customer\Controller\Account\LoginPost $subject,
        $result->setPath('/'); // Change the path to where you need to redirect
        return $result;



    "name": "vendor/module",
    "description": "Redirect homepage to customer login",
    "type": "magento2-module",
    "version": "1.0.0",
    "license": [
    "autoload": {
        "files": [
        "psr-4": {
            "Vendor\\Module\\": ""
  • Could you please explain more? should i create a module?
    – MGPM
    Aug 19, 2019 at 7:31
  • Yes, create a module and use this after plugin. Aug 19, 2019 at 8:33
  • I'm sorry but could you please give me full structure of it to create?
    – MGPM
    Aug 19, 2019 at 8:52
  • MGPM, check my updated code and let me know if you have any concern. Aug 19, 2019 at 9:28
  • Thanks, i created module with edited that i post. run commands, but still see home page! on path used $result->setPath('customer/account/login'); instead of / .
    – MGPM
    Aug 19, 2019 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.