怎样才可以有使用SSL codeIgniter负载特定的页面? [英] How can I have CodeIgniter load specific pages using SSL?
问题描述
我怎么能使用SSL codeIgniter负载特定的页面?我有一个的Apache2 / mode_ssl
服务器。 mod_ssl的
使用不同的文档根比非安全网页。例如,HTTPS(端口443)将成为页出 /无功/网络/ ssl_html /
和HTTP(80端口)提供的网页了 /中无功/ www / html等/
。我怎么会得到codeIgniter发挥好与此设置?
How can I have CodeIgniter load specific pages using SSL? I have an apache2/mode_ssl
server. mod_ssl
uses a different document root than non-secure pages. For example, https (port 443) would serve pages out of /var/www/ssl_html/
And http (port 80) serves pages out of /var/www/html/
. How would I get CodeIgniter to play nice with this setup?
推荐答案
有解决这个几个方法。
There are few ways to tackle this.
选项1:
我可能会在code部署到这两个文件夹,然后在文件中:/system/application/config/config.php,设置你的页面:
I would probably have the code deployed to both folders, then in the file: /system/application/config/config.php, set your page to:
$config['base_url'] = "http://www.yoursite.com/";
或
$config['base_url'] = "https://www.yoursite.com/";
然后在您的非SSL虚拟主机的文件夹,设置你的配置,然后按文件保护的页面重定向到SSL网站:
Then in your non-ssl VirtualHost folder, set your config to redirect protected pages by folder to the SSL site:
RedirectPermanent /sslfolder https://www.yoursite.com/sslfolder
选项2:
发送一切SSL和保持所有code一个文件夹中。
Send everything to SSL and keep all your code in one folder
/system/application/config/config.php,设置你的页面:
/system/application/config/config.php, set your page to:
$config['base_url'] = "https://www.yoursite.com/";
其他选项
有一些更哈克的方式与头要做到这一点()重定向等,但我不认为你想保持这个选项不同的code基地。我不建议这样做,但你可以这样做:
There are some more hacky ways to do this with header() redirects, etc. but I don't think you want to maintain different code bases for this option. I don't recommend this but you could do something like:
$config['base_url'] = "http://" . $_SERVER['http_host'] . "/";
这篇关于怎样才可以有使用SSL codeIgniter负载特定的页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!