I have the following code in my main config.
'urlManager' => array(
'urlFormat' => 'path',
'rules' => array(
'<controller:\w+>'=>'<controller>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
),
I have a controller called home and in my config file I have mentioned
'defaultController' => 'home'
So when I visit 127.0.0.1 home controller’s index page is shown to me. (as I expected)
However, if I try to visit
127.0.0.1/home
OR
127.0.0.1/user
I get a 404 error.
I can however visit
127.0.0.1/index.php/user
Also, if I go with
'urlFormat' => 'get',
i can use URL’s like
127.0.0.1/index.php?r=home
OR
127.0.0.1/index.php?r=user
What might I be doing wrong here?
p.s
my .htaccess file
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
I have enabled mod_rewrite on apache2, debian.
Thanks in advance.