sbmoba  
            (Bhu2y Silent)
           
           
          
              
                May 15, 2012,  8:12am
               
               
          1 
           
         
        
          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 www.myinfo.com  which is bilingual(has 2 language options : english and indonesian)
and then
I have 1 domain www.myinfo.co.id which will be redirected to www.myinfo.com  and automatically select indonesian language.
the problem is…how can I read that www.myinfo.com  was redirected from www.myinfo.co.id .
thanks…I hope I’ve made a clear explanation about my problem
         
         
           
        
            
            
            
         
         
             
             
          
       
      
        
        
          In Controller class
$hostInfo = Yii::app()->request->getHostInfo();
if(stristr($hostInfo, 'myinfo.co.id'))
{
//set language cookie/session...
}
 
and all your controllers should extend this Controller class. Hope it helps.
         
         
        
            
            
            
         
         
             
             
          
       
      
        
        
          Maybe I misunderstand your question.
try
Yii::app()->request->getUrlReferrer()
 
         
         
        
            
            
            
         
         
             
             
          
       
      
        
          
          
            sbmoba  
            (Bhu2y Silent)
           
           
          
              
                May 15, 2012,  8:39am
               
               
          4 
           
         
        
          thanks whuhacker…but  Yii::app()->request->getHostInfo(); returns the host name, not the previous url from different domain 
         
         
        
            
            
            
         
         
             
             
          
       
      
        
          
          
            sbmoba  
            (Bhu2y Silent)
           
           
          
              
                May 15, 2012,  8:43am
               
               
          5 
           
         
        
          Yii::app()->request->getUrlReferrer()
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.