I created a controller function like
public function actionRateTicket($id){
}
urlManager has the following configuration
'urlManager' => [
'class' => 'yii\web\UrlManager',
'showScriptName' => false,
'enablePrettyUrl' => true,'enableStrictParsing' => true,
'rules' => array(
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
),
],
But when I tried to access http: // mydomainname / web / ticket / rate-ticket / 2333 , (ticket is the name of the controller (TicketController.php)), it shows an Not Found (#404)error.
What is the problem? I can access all controller actions with single camel characters such as actionView, actionEdit, etc., but actionRateTicket, I can't leave. If actionRateTicket is renamed to actionRate, it works.
My controller is like this
<?php
namespace app\controllers;
use Yii;
use app\models\Techs;
use app\models\Ticket;
use app\models\Assignment;
use app\models\TicketSearch;
use app\models\ComplainType;
use app\models\TicketComplain;
use app\models\User;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use app\models\Adusers;
use yii\web\UploadedFile;
use app\helpers\Utils;
use yii\db\Expression;
use yii\filters\AccessControl;
class TicketController extends Controller {
public function behaviors() {
return [
'access' => [
'class' => AccessControl::className(),
'only' => [
'index',
'view',
'update',
'delete',
'newticket'
],
'rules' => [
[
'actions' => [
'index',
'view',
'update',
'delete',
'newticket'
],
'allow' => true,
'roles' => ['@'],
],
],
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
];
}
public function actionRateTicket($id) {
echo "in"; echo $id;
exit;
}
}
?>
My .htaccess in web folder
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php