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: .+


You might also like

Fix “Cannot redeclare class Symfony\…” in Symfony2 after upgrade
After upgrading from Symfony 2.2 to 2.3 I got this error in my application: Fatal error: Cannot redeclare...
Install a Symfony2 application using Composer
Before installing any Symfony2 project you have to meet the minimum requirements for it in your server....
Symfony2 – ErrorException: Notice: serialize() [function.serialize]: “xxx” returned as member variable from __sleep() but does not exist in …
While storing an entity from Doctrine2 in the session under a Symfony2 application I got this error: ErrorException:...
Easely add plugins to Sublime Text 2
Download Sublime Text 2 (at this moment the lastest build is 2181) and install it: Mac Windows 32...
Leave a comment ?


Leave a Comment