M
M
Maxim Vlasov2016-03-16 10:29:48
symfony
Maxim Vlasov, 2016-03-16 10:29:48

How to solve routing problem in Symfony 3?

I started to study Symphony and ran into this problem: There is a method with " /show " routing, and there is a method with " /show/{id} " routing.
Can they be combined somehow? And another strange behavior: " /show " and " /show/ " for some reason are 2 different routings. Those. if just show is specified , then jumping to show/ gives a 404 error. How to fix it?
Before that, I used Codeigniter. There with routing everything is easier.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2016-03-16
Protko @Fesor

Can they be combined somehow?

You can specify the same controller action for two routing rules. But do not "combine the rules." In general, I do not recommend "combining" these things. Duplication is dealt with differently.
On the next issue - trailing slashes. read the doc.

M
Mikhail Osher, 2016-03-16
@miraage

symfony.com/doc/current/cookbook/routing/redirect_...
But I would remove it at the nginx level.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question