Yii 2.0 Clean URL with Nginx

Figured out my problem…i would post the answer but anytime I do it is seen as spam, so I wont post the answer.

Hi,

I am following the documentation here:

THE URL -> //github.com/yiisoft/yii2/blob/master/docs/guide/start-installation.md

I have configured Nginx EXACTLY like the documentation describes.

I have my application for Yii 2 with the following URL manager configuration:


        'urlManager' => [

        'class' => 'yii\web\UrlManager',

        // Disable index.php

        'showScriptName' => false,

        // Disable r= routes

        'enablePrettyUrl' => true,

        'rules' => array(

                '<controller:\w+>/<id:\d+>' => '<controller>/view',

                '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',

                '<controller:\w+>/<action:\w+>' => '<controller>/<action>',

        ),

        ],

What i fail to understand in this new release of Yii is that if I create an action called "helloworld" in a controller named "pleasework"


class PleaseworkController extends Controller

{

  // More stuff here that i am excluding


  public action actionHelloworld()

  {

    return "hello world";


  }


}

I can access my page "//localhost/pleasework/helloworld

However I add a parameter…


class PleaseworkController extends Controller

{

  // More stuff here that i am excluding


  public action actionHelloworld($id)

  {

    return "hello world";


  }


}

And now I access my url "//localhost/pleasework/helloworld"

This will complain about id missing, which is expected

Now I try "//localhost/pleasework/helloworld/id/someid"

Here is the the "WTF" moment…404???

Now I try "//localhost/pleasework/helloworld?id=someid

OK…this works. But I have built applications in the original Yii 1.1 and this url structure works.

WHY?

Since the forum wont let me post anything and really does not value a new member’s contributions, I can say I figured out the problem…too bad I can post an answer.