Skip to content

Instantly share code, notes, and snippets.

@6ui11em
Created May 5, 2021 08:19
Show Gist options
  • Save 6ui11em/d11e8300e0d6fdbe3c9678abc40135a6 to your computer and use it in GitHub Desktop.
Save 6ui11em/d11e8300e0d6fdbe3c9678abc40135a6 to your computer and use it in GitHub Desktop.
Magento 2: Route #magento2 #route
<?xml version="1.0"?>
<!--
Credits: https://mdotacademy.snippets.cc/collection/magento-2/create-route
Place this file in either the "frontend" or "adminhtml" folder to define either
a frontend or admin route, respectively:
ex. app/code/Foo/Bar/etc/frontend/routes.xml
The "urn:magento:framework:App/etc/routes.xsd" file is used to validate this
XML file. You can inspect it at vendor/magento/framework/App/etc/routes.xsd
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<!--
The "standard" router is used to handle standard frontend requests.
Set the id to "admin" to create a backend admin route.
-->
<router id="standard">
<!--
The "id" attribute is used as a unique key for this node. It should
almost always match the value of "frontName" for consistency reasons.
Its value cannot contain dashes, so underscores can be used instead.
The "frontName" is used to catch incoming requests. This route listens
for requests being made to: /my-route/*/*
-->
<route id="my_route" frontName="my-route">
<!--
The "route" node looks for "module" nodes with "name" attributes.
These are the modules responsible for handling these requests.
-->
<module name="Foo_Bar"/>
</route>
</router>
</config>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment