当我将项目服务器复制到本地时,我正在codeIgniter上工作,但未加载本地,它将重定向到localhost / dashboard

问题描述

codeIgniter版本2.2.6,我的项目在服务器上运行,而PHP版本7.3在本地 但是问题是,当我从c/xampp/htdocs在本地运行项目时 通过localhost / testsite重定向http://localhost/dashboard/页面

这是我的.htacess文件

RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\.testsite\.com$ [NC]
RewriteRule ^(.*)$ https://www.testsite.com/$1 [L,R=301]


RewriteEngine on
RewriteCond $1 !^(index\.PHP|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.PHP/$1 [L,QSA]

这是index.PHP文件

if (defined('ENVIRONMENT'))
{
    switch (ENVIRONMENT)
    {
        case 'development':
            error_reporting(E_ALL ^ E_NOTICE);
            //error_reporting(E_ALL);
        break;

        case 'development':
        case 'development':
            error_reporting(0);
        break;

        default:
            exit('The application environment is not set correctly.');
    }
}

这是我的application/config/config.PHP文件

if ($_SERVER['SERVER_NAME']=="localhost") {
    $config['base_url'] = 'http://localhost/public_html';
    $config['index_page'] = '';
}elseif  ($_SERVER['SERVER_NAME']=="uat.icwdc.com") {
    $config['base_url'] = 'http://uat.icwdc.com/testsite';
    $config['index_page'] = '';
}else {
    $config['base_url'] = 'https://www.testsite.com';
    $config['index_page'] = '';
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)