Ejemplo n.º 1
0
function ActivePlugin_forcehttps()
{
    if (!forcehttps_isHttps()) {
        $redirect_url = "https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
        Redirect301($redirect_url);
    }
}
Ejemplo n.º 2
0
 /**
  * 检测当前url,如果不符合设置就跳转到固定域名的链接
  */
 public function RedirectPermanentDomain()
 {
     if ($this->option['ZC_PERMANENT_DOMAIN_ENABLE'] == false) {
         return;
     }
     if ($this->option['ZC_PERMANENT_DOMAIN_REDIRECT'] == false) {
         return;
     }
     if ($this->option['ZC_PERMANENT_DOMAIN_INDISCRIMINATE_HTTPS'] == true) {
         $host = str_replace(array('https://', 'http://'), array('', ''), GetCurrentHost(ZBP_PATH, $null));
         $host2 = str_replace(array('https://', 'http://'), array('', ''), $this->host);
     } else {
         $host = GetCurrentHost(ZBP_PATH, $null);
         $host2 = $this->host;
     }
     if (stripos($host, $host2) === false) {
         $u = GetRequestUri();
         $u = $this->host . substr($u, 1, strlen($u));
         Redirect301($u);
     }
 }