[Solved] Yii2 $_GET parameter in URL


Inside your config, where you declare your components, add or modify the urlManager like this:

'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'enableStrictParsing' => false,
            'rules' => [
                'projects/<url>' => 'projects/ACTION',
            ],
        ],

In order for this to work, first, the path projects/action has to match your controller action, and then projects/<url> means that when you build a link you need to pass the parameters required with the url, example:
<a href="https://stackoverflow.com/questions/59048381/projects/ACTION?url=test" >test</a>

Yii then will transform the url to the pretty url you want.

I recommend you to use the slug field, and use the default behavior sluggable

0

solved Yii2 $_GET parameter in URL