I have used custom urls in my application. When i create message it redirect me to the create form but when i submit the form it redirects back to the same form again. There is a condition in the controller if the $_POST variable is set then save it else redirect to the form. I thought the $_POST variable is not setting but when i print it in the form it was printed there. So, if the $_POST variable is set then why the condition fails? Following is my custom urls. Before using custom urls it was working ok.
'urlManager' => array(
'urlFormat' => 'path',
'showScriptName' => false,
'rules' => array(
'' => 'questions/index',
'messages' => 'messages/index',
'tags' => 'tags/index',
'login' => 'site/login',
'signup' => 'users/create',
'<id:\w+>' => 'users/view',
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
'gii' => 'gii',
'gii/<controller:\w+>' => 'gii/<controller>',
'gii/<controller:\w+>/<action:\w+>' => 'gii/<controller>/<action>',
),
),
And this is my .htaccess file.
Options +FollowSymLinks
IndexIgnore */*
<IfModule mod_rewrite.c>
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
</IfModule>
Is there something wrong here..?
EDIT
Here is my controller code.
public function actionUpdate($id) {
$model = $this->loadModel($id);
if (isset($_POST['User'])) {
$model->attributes = $_POST['User'];
if ($model->save())
$this->redirect(array('view', 'id' => $model->id));
}
$this->render('update_info', array(
'model' => $model,
));
}