urlManager Rules

Hi,

I’ve been working with Yii 1.1.x for about a year now and I am familiar with the way routing work, but why does the following not work in Yii 2.0?

web.php




'urlManager' => [

 'class' => 'yii\web\UrlManager',

 'enablePrettyUrl' => true,

 'showScriptName' => false,

 'suffix' => '.html',

 'rules' => [

  'signin' => 'site/SignIn',

 ]

]



SiteController




public function actionSignIn()

{

   return $this->render($this->action->id);

}



form.php




<?php $form = ActiveForm::begin(['id' => 'signin-form', 'action' => 'signin']); ?>

<div class="login-box">

	<i class="fa fa-sign-in fa-5x"></i>

	

	<div class="username">

		<?=

		$form->field($model, 'username')

		->textInput([

			'id'          => 'username',

			'placeholder' => 'Username',

			'class'       => null

		])

		->label(false);

		?>

	</div>

	

	<div class="password">

		<?=

		$form->field($model, 'password')

		->passwordInput([

			'id'          => 'password',

			'placeholder' => 'Password',

			'class'       => null

		])

		->label(false);

		?>

	</div>

	

	<div class="sign-in"><?= Html::submitButton('Sign in', ['class' => 'btn btn-success btn-lg btn-block', 'name' => 'login-button']) ?></div>

</div>

<?php ActiveForm::end(); ?>



signin.php


Hello World

The end result of this when posting to "signin" is


The requested URL /signin was not found on this server.

Any help is appreciated.

can anyone shed some light into this issue?

EDIT: OK so after many google search and browsing the Yii forum, stupid mistake on my end, placed the .htaccess in the wrong folder, so when turning on ‘enablePrettyUrl’ the page was not found. For anyone else having the same issue make sure to place your .htaccess in the /web folder and not in the application root folder. also if you turn on suffix, make sure your link has the correct extension.