Advanced routing configuration

3.x version
Maintained

Advanced routing configurationΒΆ

By default, the routing file @FOSUserBundle/Resources/config/routing/all.xml imports all the routing files (except groups) and enables all the routes. Use @FOSUserBundle/Resources/config/routing_41/all.xml for Symfony4.1. In the case you want to enable or disable the different available routes, just use the single routing configuration files.

Use routing_41 instead of routing for Symfony4.1.

  • YAML
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    # app/config/routing.yml
    fos_user_security:
        resource: "@FOSUserBundle/Resources/config/routing/security.xml"
    
    fos_user_profile:
        resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
        prefix: /profile
    
    fos_user_register:
        resource: "@FOSUserBundle/Resources/config/routing/registration.xml"
        prefix: /register
    
    fos_user_resetting:
        resource: "@FOSUserBundle/Resources/config/routing/resetting.xml"
        prefix: /resetting
    
    fos_user_change_password:
        resource: "@FOSUserBundle/Resources/config/routing/change_password.xml"
        prefix: /profile
    
  • XML
    1
    2
    3
    4
    5
    6
    <!-- app/config/routing.xml -->
    <import resource="@FOSUserBundle/Resources/config/routing/security.xml"/>
    <import resource="@FOSUserBundle/Resources/config/routing/profile.xml" prefix="/profile" />
    <import resource="@FOSUserBundle/Resources/config/routing/registration.xml" prefix="/register" />
    <import resource="@FOSUserBundle/Resources/config/routing/resetting.xml" prefix="/resetting" />
    <import resource="@FOSUserBundle/Resources/config/routing/change_password.xml" prefix="/profile" />
    

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.