I am trying to redirect url to my custom no route found page but it always redirect to default 404 page,

I have made below changes in my module

Step-1 Create below file in Controller Folder CustomNoRouteHandler.php


namespace SimplifiedMagento\RequestFlow\Controller\Page;

class CustonNoRouteHandler implements \Magento\Framework\App\Router\NoRouteHandlerInterface
    public function process(\Magento\Framework\App\RequestInterface $request)

        return true;

Step-2 My redirect page which should be display while no route found,


namespace SimplifiedMagento\RequestFlow\Controller\Page;

use Magento\Framework\App\Action\Action;
use Magento\Framework\App\ResponseInterface;

class CustomNoRoute extends Action
    public function execute()
        echo "this is our custom 404 page";

Step-3 In 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="Magento\Framework\App\Router\NoRouterHandlerList">
            <argument name="handlerClassList" xsi:type="array">
                <item name="handlerinfo" xsi:type="array">
                    <item name="class" xsi:type="string">SimplifiedMagento\RequestFlow\Controller\Page\CustonNoRouteHandler</item>
                    <item name="sortOrder" xsi:type="string">50</item>

Step-4 In etc/frontend/routes.xml

<?xml version="1.0"?>
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
    <router id="standard">
        <route id="noroutefound" frontName="noroutefound">
            <module name="SimplifiedMagento_RequestFlow" />
  • what's URL you are run ??? Commented May 19, 2020 at 5:21
  • any wrong url like "domain/abababa", so if no route found than it should redirect to my custom url "domain/noroutefound/page/customnoroute". Commented May 19, 2020 at 5:37
  • if you want to this type prnt.sc/sjfj5o Commented May 19, 2020 at 6:05
  • yes but it redirect me to default 404 page layout. Commented May 19, 2020 at 6:15
  • Step-3 Aurgment name is incorrect handlerClassList it should be handlerClassesList Commented Jun 24, 2021 at 20:37

1 Answer 1


I have done the same custom 404 page for one of my extension.

I see a difference of code in Route php file process method.

Your ones is


While i found in my code is


Also put di.xml inside etc/di.xml insetad of etc/frontend/di.xml

Try this change once if that work for you.

  • i tried your code but it is not working as well. Commented May 19, 2020 at 8:37
  • You should put di.xml code inside etc/di.xml instead of etc/frontend/di.xml and it will work.
    – Yash Shah
    Commented May 19, 2020 at 9:14
  • already tried this but not working. Commented May 19, 2020 at 10:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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