Answer the question
In order to leave comments, you need to log in
Yii2: how to redirect config settings controller url?
'components' => [
'urlManager' => [
'baseUrl' => '',
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'search' => 'site/index',
...
],
...
site.com/search
-- it works. If you go to site.com/site/index
works and shows the same content. How to fix it with auto redirect to config settings and parameters? ( site.com/site/index?param=1
-> site.com/search?param=1
)
Answer the question
In order to leave comments, you need to log in
Delete it altogether actionIndex
in this case:
class SiteController extends Controller
{
public $defaultAction = 'search';
public function actionSearch() { ... }
}
'rules' => [
'search' => 'site/search',
...
],
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question