{{ path('post_show', { 'id': entity.id, 'slug': entity.slug }) }} controller action 1 @Route("/{id}/show", name="post_show2") $this->redirect($this->generateUrl('post_show', array('id' => $entity->getID(), 'slug' => $entity->getSlug() )),301); controller action 2 @Route("/{slug}-{id}/", requirements={"slug" = "[a-z0-9\-]+", "id" = "^\d+$"}, name="post_show") layout {% if canonical_url is defined %} <link rel="canonical" href="{{ canonical_url }}"/> {% endif %}