0

I have a noob question, but googling for several hours didn't get me closer to the answer.

I want that when I enter the following url into my browser, that is gets assigned to a specific controller action.

Imagine I have the following url:

http://localhost:5555/tractor-unit/?param1=1&param2=abc

How should the rules looks like to process this request in a certain action in a certain controller.

What I've tried so far:

'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'rules' => [
                'tractor-unit/?param1=<param1:\d+>&param2=<param2:\w+>' => 'tractor/do'
            ]
        ],

That doesn't work. I just don't understand how the rules entry should be written in order to pass this request to a controller named tractor and its action do. Or maybe I totally misunderstood the whole url manager concept.

idunno
  • 71
  • 8

1 Answers1

0

simple add to action "do" in tractor-unit controller next:

public function actionDo($param1=null, $param2 = null)

if this don't work
remove section "rules" from config

  • I am sorry. This doesn't work. It still tells me 404 page not found. Looks like the rule is wrong. And even if I remove all rules and and put this method in tractorUnitController it doesn't work :( Thx for trying though. – idunno Mar 27 '21 at 22:07