2

My url must looks like:

http://example.com/search/1/?cmp_name=&cmp_city=&cmp_category=&cmp_code=&cmp_vat=&cmp_address=&cmp_emp_from=&cmp_emp_till=&cmp_return_from=&cmp_return_till=&search_only_name=1

How to write route for this url ?

What I try:

search:
    pattern: /search/{page}
    defaults: { _controller: CatalogWebBundle:Default:search }
    options:
        expose: true

But getting error:

No route found for "GET /search/1/" (from "http://example.com:8000/")

What is wrong with my route ?

0

2 Answers 2

3

The point here is that the pattern of your route definition doesn't match your url because of the additional / at the end of your url.

This should match,

http://example.com/search/1?param1=value1&param2=value2&...
Sign up to request clarification or add additional context in comments.

Comments

0

Try this:

# app/config/routing.yml
search:
    path:      /search/{page}/
    defaults:  { _controller: CatalogWebBundle:Default:search, page: 1 }
    requirements:
        page:  \d+

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.