F
F
First Name2017-09-25 14:15:49
Yii
First Name, 2017-09-25 14:15:49

How to set up the CNC correctly with the Get parameter?

Good day to all.
It is necessary to bring such a link to mind. I have already read the documentation a hundred times, googled it, but I just can’t understand, the rest of the rules all work, but this one doesn’t:
http://site.dev/search/?name=Ivanod
http://site.dev/search/Ivanod

'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'suffix' => '/',
            'normalizer' => [
                'class' => 'yii\web\UrlNormalizer',
                // use temporary redirection instead of permanent for debugging
                'action' => UrlNormalizer::ACTION_REDIRECT_TEMPORARY,
                'normalizeTrailingSlash' => true
            ]
 'rules' => ['/search/<brand_name:.+>' => 'site/search']

.htaccess is set up correctly as other rules work.
Hope you can help me, thanks in advance for your answers.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry, 2017-09-25
@maxxtweek

Good afternoon.
Here is a link to the official documentation . Just about CNC. Study the section and not only this one, but also others.
And the urlManager rules with a parameter might look like this:

rules => [
  '<_c:[\w]+>/<_a:[\w]+>/<id:\d+>' => '<_c>/view'
]

P
pro100yurio, 2017-09-25
@pro100yurio

I don’t know about this issue, but I saw https://habrahabr.ru/post/42172/
Read it yourself already))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question