Answer the question
In order to leave comments, you need to log in
How to properly configure routing on Yii 2 on apache server?
Good day to all.
Terribly stupid question, but still.
There is a standard controller (SiteController) which has a Login action.
Apache 2.4 is installed on the local server (OSPanel), everything works fine, uploaded to the server, gives a 404 error.
.htaccess file in /web folder only
RewriteEngine On RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
public function actionLogin()
{
if (!Yii::$app->user->isGuest) {
return $this->goHome();
}
$model = new LoginForm();
if ($model->load(Yii::$app->request->post()) && $model->login()) {
return $this->goBack();
}
$model->password = '';
return $this->render('login', [
'model' => $model,
]);
}
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
// ''=>'site/index',
// '<action>'=>'site/<action>',
],
],
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question