I'm using Yii 1.1.17, and i noticed on some of my pages where i want just registered users to be able to view I'm getting a soft 404 error on Google's webmasters tools.
For example
http://www.example.com/sell/
when you go to http://www.example.com/sell/view
it would redirect you to http://www.example.com/login
Right now i only have 240 soft 404 errors. The view action was not set to registered users only at first.But after a couple of months after launching my site. I changed it. Then the errors starting poping up.
Is there a way to fix this? or a work around?
here is accessRules for the view
action that is only for registered users:
public function accessRules()
{
return array(
array('allow',
'actions'=>array('index', 'new'),
'users'=>array('*'),
),
array('allow',
'actions'=>array('view'),
'users'=>array('@'),
),
array('allow',
'actions'=>array('admin','delete', 'update', 'create','update','upload'),
'expression'=>'app()->user->isAdmin()',
),
array('deny',
'users'=>array('*'),
),
);
}
In a simple way, you just need to identify it to the controller. If not a user login, it will automatically be taken to the login page. Like the example below:
Hopefully can help
you just embed dbmanager / rbac library to your yii apps,
You could add a
deniedCallback
asYou can then redirect with whatever status code you'd like.
You can find out more about
deniedCallback
here.Find out more about
redirect
here