I am creating custom module which redirect to login if third party module route id find.(frontend)

but i have issue how to identify the current route is default or third party route ?

how to check current route is default or third party ?

1 Answer 1


I can give you some hint for this problem.
You can try by looking into class \Magento\Framework\App\Route\Config at file


the function _getRoutes of Magento2 will return list of route's info as below.
(You may have to extend a new class from this because the scope of function is protected ) enter image description here

Based on current route as a frontName, you can extract the module info of this route as modules. From that you can know whether this module belong to Magento 2 default route or not.
I hope this will work for you.

  • Please explain with running example.
    – Msquare
    Mar 23, 2020 at 2:15
  • My Question is how to identify the current page route is magento default route or Third party route ??
    – Msquare
    Mar 23, 2020 at 2:18

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.