Invalid Url In Afterlogin


In MyWebUser class in checkAccess if login was not succesful I save in session last route to reopen this page on next login :

	public function checkAccess($operation, $params=array(), $allowCaching=true)


		$ret= $this->isSuperuser===true ? true : parent::checkAccess($operation, $params, $allowCaching);

                if ( !$ret ) {

			$route = Yii::app()->getUrlManager()->parseUrl(Yii::app()->getRequest()); // HAS relative url like backend/category/index



		return $ret;


And In afterLogin I get prior route and redirect to it :

	public function afterLogin($fromCookie)


		if( Rights::getAuthorizer()->isSuperuser($this->getId())===true ) {

			$this->isSuperuser = true;


		$referer_page_route= Yii::app()->user->getState('referer_page_route');

		if ( !empty($referer_page_route) ) { // HAS relative url like backend/category/index

			Yii::app()->controller->redirect(array( $referer_page_route) ); 


It redirects but url is like, I mean that url is relative to module /user, so the url is invalid.

In layout of app I added row like to set root of dir for relative urls :

<!DOCTYPE html>

<html lang="en">

<head><!-- HEAD START -->

	<base href="<?php echo Yii::app()->createAbsoluteUrl('/'); ?>/">

	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>


It works in all cases, exceting this. How to fix it ?


take look at this ext might help you

Themes that is not the point.

Point is that is some cases base of my app is different then I show in header of template

<base href="<?php echo Yii::app()->createAbsoluteUrl(’/’); ?>/">

and relative are invalid url . How do you set base for your app ? As I show above or in other way ?

Also I noticed that when control is in user module(I use it in my app) and I have to make redirect(say after login or logout) and I use relative urls for redirection, I get error as redirection url has more "user/" like "" but must be "",

where "" is base of site and "backend/category/index" is relative url for redirection.

But why url is with "user/" ? Is it some feature of user module or yii modules ?

what about this ???


echo Yii::app()->user->returnUrl;