how to get previuos url but from different domain

hello all yii master…is it possible to get previous url but its from a different domain.

here is the case :

I have one website which is bilingual(has 2 language options : english and indonesian)

and then

I have 1 domain which will be redirected to and automatically select indonesian language.

the problem is…how can I read that was redirected from .

thanks…I hope I’ve made a clear explanation about my problem

In Controller class

$hostInfo = Yii::app()->request->getHostInfo();

if(stristr($hostInfo, ''))


//set language cookie/session...


and all your controllers should extend this Controller class. Hope it helps.

Maybe I misunderstand your question.



thanks whuhacker…but Yii::app()->request->getHostInfo(); returns the host name, not the previous url from different domain :)


I already try this one, but it only returns the url within my website…it cannot read url from another domain

Check source code of getUrlReferrer()

public function getUrlReferrer()


    return isset($_SERVER['HTTP_REFERER'])?$_SERVER['HTTP_REFERER']:null;


$_SERVER[‘HTTP_REFERER’] is set by the user agent. So, if your browser really sent the HTTP Referer header, it may be some third party “Internet Security” tool like Nortons or AVG Advanced or something similar that is set “hide your tracks” while browsing.

use this - Yii::app()->request->getUrl();

and save it.