php - Force Https for custom pages -
i followed following tutorial: yii 1.1: url management websites secure , nonsecure pages
this code /protected/config/main.php
'urlmanager'=>array( 'class' => 'urlmanager', 'hostinfo' => 'http://goliv.me', 'securehostinfo' => 'https://goliv.me', 'secureroutes' => array( 'site/booking', // site/login action ), 'urlformat' => 'path', 'showscriptname' => false, 'casesensitive' => false, 'urlsuffix' => '.html', 'rules' => array( '<controller:\w+>/<id:\d+>'=>'<controller>/view', '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>', '<controller:\w+>/<action:\w+>'=>'<controller>/<action>', '<module:\w+>/<controller:\w+>/<action:\w+>' => '<module>/<controller>/<action>' ), ),
and .htaccess
file:
rewriteengine on # if directory or file exists, use directly rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d # otherwise forward index.php rewriterule . index.php
i'm facing following problem site/booking
:
this webpage has redirect loop
when remove part:
'secureroutes' => array( 'site/booking' ),
everything works without problems.
any solutions?
the method not correcty return true if there slash @ end of route, calling site/booking/ not return true.
class urlmanager extends curlmanager { ................ /** * @param string url route checked * @return boolean if give route should serviced in ssl mode */ protected function issecureroute($route) { if ($this->_securemap === null) { foreach ($this->secureroutes $r) { $this->_securemap[strtolower($r)] = true; } } $route = strtolower($route); if (isset($this->_securemap[$route])) { return true; } else { return ($pos = strpos($route, '/')) !== false && isset($this->_securemap[substr($route, 0, $pos)]); } }
Comments
Post a Comment