Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Use Colon as seperator in url

Hi

I want to use site/post:110 instead of normal routing: site/post/110

how I can do that?

I also added a routing but not working:

          $router->add('/post(:)([0-9])', array(
            'module' => 'backend',
            'controller' => 'posts',
            'action' => 'show',
            'id' => 2
        ));


82.2k
Accepted
answer

This way:

$router->add('/post:([0-9]+)', array(
    'module' => 'backend',
    'controller' => 'posts',
    'action' => 'show',
    'id' => 1
));