Php CodeIgniter网站在迁移在线服务器后重定向到本地主机

Php CodeIgniter网站在迁移在线服务器后重定向到本地主机,php,codeigniter,Php,Codeigniter,我刚刚把我的应用程序上传到我的托管帐户上,该帐户由hostinger提供。你可以看到链接 配置文件: <?php class SystemConfiguration { // General Settings public static $base_url = 'http://primodebug.esy.es/Calendario/'; // Database Settings public static $db_host = 'mysql.hostinger.it'; p

我刚刚把我的应用程序上传到我的托管帐户上,该帐户由
hostinger
提供。你可以看到链接

配置文件:

<?php
class SystemConfiguration {
// General Settings
public static $base_url    = 'http://primodebug.esy.es/Calendario/';
// Database Settings
public static $db_host     = 'mysql.hostinger.it';
public static $db_name     = 'u460105738_primo';
public static $db_username = 'u460105738_ferve';
public static $db_password = '*****';

我在记录相关文件时也有其他问题。httaccess我不知道,但似乎有些javascript文件没有正确加载。可以是什么?

首先查看/application/config/config.php,其中的
$config['base\u url']
项应设置为您的托管帐户

 $config['base_url'] = 'http://primodebug.esy.es/';
如果设置为如图所示,则在代码的其他地方有硬编码的“localhost”

在本例中,需要在加载系统配置之前加载Codeigniter的“URL帮助器”。所以运行
$this->load->helper('url')加载系统配置之前的某个位置。或者,可以像这样在SystemConfiguration的构造函数中完成

<?php
class SystemConfiguration {
// General Settings
public static $base_url;
// Database Settings
public static $db_host     = 'mysql.hostinger.it';
public static $db_name     = 'u460105738_primo';
public static $db_username = 'u460105738_ferve';
public static $db_password = '*****';
}

function __construct()
{
  $this->CI->load->helper('url');
  $this->base_url = base_url('Calendario/')
}

首先要查看的是/application/config/config.php,其中
$config['base\u url']
项应设置为您的托管帐户

 $config['base_url'] = 'http://primodebug.esy.es/';
如果设置为如图所示,则在代码的其他地方有硬编码的“localhost”

在本例中,需要在加载系统配置之前加载Codeigniter的“URL帮助器”。所以运行
$this->load->helper('url')加载系统配置之前的某个位置。或者,可以像这样在SystemConfiguration的构造函数中完成

<?php
class SystemConfiguration {
// General Settings
public static $base_url;
// Database Settings
public static $db_host     = 'mysql.hostinger.it';
public static $db_name     = 'u460105738_primo';
public static $db_username = 'u460105738_ferve';
public static $db_password = '*****';
}

function __construct()
{
  $this->CI->load->helper('url');
  $this->base_url = base_url('Calendario/')
}

所有url都是正确的。。我怀疑我应该使用一些设置编辑.htaccess文件,但我不知道如何编辑此文件,可能会对我有所帮助..?您的.htaccess对localHost一无所知,因此没有理由将其添加到服务器请求中。浏览器将请求的url显示为“”,因此在代码中的某个地方,有人在向url添加“localhost”。如果设置了config.php,那么问题可能出现在routes.php甚至javascript中。当我重新加载文件时,链接运行良好,并且没有重定向到localhost,几分钟后问题又出现了。在我的代码中没有本地主机引用。。我正在使用$base\u url变量连接代码的每个部分。所有url都是正确的。。我怀疑我应该使用一些设置编辑.htaccess文件,但我不知道如何编辑此文件,可能会对我有所帮助..?您的.htaccess对localHost一无所知,因此没有理由将其添加到服务器请求中。浏览器将请求的url显示为“”,因此在代码中的某个地方,有人在向url添加“localhost”。如果设置了config.php,那么问题可能出现在routes.php甚至javascript中。当我重新加载文件时,链接运行良好,并且没有重定向到localhost,几分钟后问题又出现了。在我的代码中没有本地主机引用。。我使用$base_url变量连接代码的每个部分。