Codeigniter,基本url始终在url中返回https协议
我已经在codeigniter中对我的网站和fb应用程序进行了编码,目前正在生产中,并按预期工作,但我无法找出什么。当我使用base_url时,它总是返回带有https协议的url,无论我当前是否使用http 我的config.php中有这个Codeigniter,基本url始终在url中返回https协议,codeigniter,https,base-url,Codeigniter,Https,Base Url,我已经在codeigniter中对我的网站和fb应用程序进行了编码,目前正在生产中,并按预期工作,但我无法找出什么。当我使用base_url时,它总是返回带有https协议的url,无论我当前是否使用http 我的config.php中有这个 /* |-------------------------------------------------------------------------- | Base Site URL |--------------------------------
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
| http://example.com/
|
| If this is not set then CodeIgniter will guess the protocol, domain and
| path to your installation.
|
*/
$config['base_url'] = '';
起初,网站和应用程序仅为https,但我发现谷歌广告不支持它,因此我必须使网站也在http中工作
例如:
(portalshared['base_url']携带配置读取的来自我的控制器的base_url值)
内部控制器
$this->portalshared = array('base_url' => $this->config->item('base_url') ...
鉴于
<?php foreach ($mostviewed as $post) { ?>
<tr>
<td>
<a target="_blank" href="<?php echo $this->portalshared['base_url'].'portal/post/'.(string)$post['_id'].'.html';?>"><?php echo $post['message'];?></a>
</td>
</tr>
<?php } ?>
结果:
<tr>
<td>
<a href="https://mydomain/portal/post/51a5ee91c993888b63000007.html" target="_blank">message here</a>
</td>
</tr>
预期结果(因为我正在浏览http站点):
出于某种原因,我的codeigniter没有正确猜测协议?这一定是主机问题,而不是codeigniter。检查htaccess文件是否正常,然后检查主机配置
<tr>
<td>
<a href="http://mydomain/portal/post/51a5ee91c993888b63000007.html" target="_blank">message here</a>
</td>
</tr>