If you look at @FOSUserBundle/Resources/config/routing/profile.xml
, you will see the following routings. You can overwrite any routing (or other configuration) by using the same name in your own routing
<route id="fos_user_profile_show" path="/" methods="GET">
<default key="_controller">FOSUserBundle:Profile:show</default>
</route>
<route id="fos_user_profile_edit" path="/edit" methods="GET POST">
<default key="_controller">FOSUserBundle:Profile:edit</default>
</route>
In your own routing.yml you'd simply overwrite like this:
fos_user_profile_show:
path: /profile/{id}
defaults: { _controller: AppBundle:Profile:show }
fos_user_profile_edit:
path: /profile/edit/{id}
defaults: { _controller: AppBundle:Profile:edit }
Note that most likely you are no longer using the default ProfileController
, but instead have your own ProfileController
extending the FOSUserBundle ProfileController
. That's why I also changed the controller to AppBundle:Profile:edit
, but obviously this needs to match your code.
Also note the {id}
needs to be implemented in your code, ex.:
public function showAction(Request $request, $id)
Also see here for a more detailed answer (for another route): How to customize FOS UserBundle URLs