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.

how to Rewrite URL in phalcon

how to Rewrite URL in phalcon. example : http://localhost/cms-framework-php/1/product I want Rewrite http://localhost/cms-framework-php/product thansk you!


Hi there, Can I ask what's the point of doing this routing? The value "1" is an ID of product?

yes '1' is an product

router $route = $router->add( "/{id}/([a-zA-Z0-9_-]+)", [ 'namespace' => 'MyApp\Controllers', "controller" => "product", "action" => "index", "id" => 1, "title" => 2, ] );

In my logic you can have '/1/product' and than you can use the parameter '1' in Controller


'/product' but you have no access to this param.

How do you plan to read the product's ID from this url: http://localhost/cms-framework-php/product or are you going to query the database to retrieve the ID based on the product's name?