Document the Magento2 storefront redirection #86
Description
From our legacy documentation:
Front-End
Introduction
Front-Commerce's Magento module comes with a default system
to disable stock front-end. It restricts access to front-end
URLs while keeping the back-end available. It offers a few
configuration options to permit some routes to stay
available.
Temporarily disable the restriction
By default, every request to the front-end will be
redirected to FC's root.
You can disable the "firewall" by choosing "No" from the
administration panel > General > FrontCommerce > Disable
Magento Front-End.
Granular configuration
Three behaviors are available :
- Accept the requested route and let Magento handle it
casually (useful for payment modules). - Forward the requested route to FC : the redirection will
have the same path but will use FC's base URL instead of
Magento's. - Manually choose the target route.
If none of these rules matched, the request will be
redirected to FC's root.
The matching system use regexes that will be computed
against the request's URI.
They are configurable via the standard Dependency Injection
System.
Here is an example configuration :
<type name="FrontCommerce\Integration\Observer\DisableFrontEnd">
<arguments>
<argument name="routingPolicies" xsi:type="array">
<item name="/accept/" xsi:type="const">FrontCommerce\Integration\Observer\DisableFrontEnd::ROUTING_POLICY_ACCEPT</item>
<item name="/forward/" xsi:type="const">FrontCommerce\Integration\Observer\DisableFrontEnd::ROUTING_POLICY_FORWARD</item>
<item name="/account/" xsi:type="string">user</item>
</argument>
</arguments>
</type>
Every request matching /accept/
will be handled by
Magento (use-case n°1).
Every request matching /forward/
will be forwarded to FC
(use-case n°2).
Every request matching /account/
will be redirected to
<fc-url>/user
(use-case n°3).
Remaining requests will be redirected to FC root.