Bad Request (#400): Missing required parameters: id

I am trying to load a view:

student/view?id=1

This is a view that was generated in Gii, I get this error:

This is the control action:


    /**

     * Displays a single Student model.

     * @param integer $id

     * @return mixed

     */

    public function actionView($id)

    {

        return $this->render('view', [

            'model' => $this->findModel($id),

        ]);

    }

Here is my .htaccess file. Can anyone tell me if this is going to screw up the url parameters?


RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ /index.php?/$1 [L]

solved! was the .htaccess file being badly configured

This fixed it


RewriteEngine on

# If a directory or a file exists, use it directly

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

# Otherwise forward it to index.php

RewriteRule . index.php

1 Like