[ 'request' => [ // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation 'cookieValidationKey' => '', ], ], ]; if(isset($_SERVER['REQUEST_URI'])){ preg_match('/\?r=(.*?)[%2F|\/]|(.*?)&r=(.*?)[%2F|\/]/',$_SERVER['REQUEST_URI'],$match); $config['components']['urlManager']['enablePrettyUrl'] = !$match ? true : false; } return $config;