---
title: Dynamic Routing in Symfony
description: Learn how to enable dynamic rendering of new stories by setting up a catch-all route in Symfony.
url: https://storyblok.com/docs/guides/symfony/dynamic-routing
---

# Dynamic Routing in Symfony

The Storyblok Symfony bundle automatically handles dynamic routing based on the slugs and content types defined in Storyblok.

## **Fetch a story dynamically**

The bundle creates a catch-all route that matches any URL pattern and attempts to resolve it. No need to manually specify routes for each individual story.

When you register a content type controller with the `#[AsContentTypeController]` attribute, the bundle automatically:

1.  Creates a route that matches the content type.
2.  Fetches the story from Storyblok based on the URL slug.
3.  Instantiates the content type class with the story data.
4.  Calls the controller with the content type instance.

## Fallback behavior

The bundle provides a fallback for unavailable content.

config/packages/storyblok.yaml

```plaintext
base_uri: '%env(STORYBLOK_API_BASE_URI)%'
token: '%env(STORYBLOK_API_TOKEN)%'
version: '%env(STORYBLOK_VERSION)%'
controller:
  ascending_redirect_fallback: true
```

Enable the feature. Now, if a user visits a page that doesn't exist, the bundle automatically redirectd them to its closest parent route.

## Related resources

[Symfony Routing Docs](https://symfony.com/doc/current/routing.html)

[Storyblok Symfony Bundle Docs](https://github.com/storyblok/symfony-bundle)

[Content Delivery API: Retrieve a Single Story](/docs/api/content-delivery/v2/stories/retrieve-a-single-story)

[Content Delivery API: Retrieve Multiple Stories](/docs/api/content-delivery/v2/stories/retrieve-multiple-stories)

## Pagination

-   [Previous: Visual Preview in Symfony](/docs/guides/symfony/visual-preview)
-   [Next: Content Modeling in Symfony](/docs/guides/symfony/content-modeling)
