Changing Codeigniter site from http to https site

2019-03-06 10:00发布

问题:

I have a codeigniter site ,that working perfectly when it is in http.

Then our client moved the site to new server which have the https security.

That means now the site url is http://mysite.com.

But now my site is not working correctly...

What is the reason for that?

That is my codeigniter site not working in https.

It just display the home page ,and no jquery effects etc are not working..

I already changed the base_url in config.php as https://mysite.com.

回答1:

Try this

function redirectToHTTPS()
{
  if($_SERVER['HTTPS']!="on")
  {
     $redirect= "https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
     header("Location:$redirect");
  }
}