6

I have route like this:

   * @Route(
   *        "/search/{ro}/{mind}/{his}",
   *        name="search",
   *        requirements={"ro"="[a-zA-Z]{2,}", "mind"="()|new|old", "his"="()|yes|ok|no"}
   *    )

if I want this url: /search/yes I need to enter this address: /search///yes to show page.
how can remove // from original url?

1 Answer 1

6

welcome to stackoverflow,

you know you can have multiple routes for one action?

Just be aware of the order of the routes - the more parameters the higher - or a lesser route will catch first.

   * @Route(
   *        "/search/{ro}/{mind}/{his}",
   *        name="search",
   *        requirements={"ro"="[a-zA-Z]{2,}", "mind"="()|new|old", "his"="yes|ok|no"}
   *    )

   * @Route(
   *        "/search/{his}",
   *        name="search_short",
   *        requirements={"his"="yes|ok|no"}
   *    )
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.