Tag Archives: dot

Symfony2 routing: Allow dots in URL

I have one route in my app that must have a text and a dot followed by a format. For example:


As you can see it’s an url that can contain dots before the dot that splits the {text} and the {_format} parts.

To make this work you have to define the route in routing.yml using a regexp for {text} this way:

    pattern:  /image/{text}.{_format}
    defaults: { _controller: AcmeDemoBundle:Demo:image, _format: png }
        _format: png|jpg
        text: .+

Ref: http://stackoverflow.com/questions/18098583/error-in-symfony2-when-url-cointains-dot