修改librarIEs下面config.PHP中把
return $this->slash_item('base_url').$this->slash_item('index_page').trim($uri, '/').$suffix;
替換為
if (substr(PHP_sapi_name(), 0, 3) == 'CGI')
{
return $this->slash_item('base_url').trim($this->slash_item('index_page'),"/")."?".trim($uri, '/').$suffix;
}else {
return $this->slash_item('base_url').$this->slash_item('index_page').trim($uri, '/').$suffix;
}
就可以解決路徑訪問問題,
首頁加載問題處理如下:
修改librarIEs下Router.PHP文件
在 if ($this->uri->uri_string == '')名句上面加如下片斷
if (substr ( PHP_sapi_name (), 0, 3 ) == 'CGI') {
$ishomeCGI=substr($this->uri->uri_string,-10);
if($ishomeCGI=="index.PHP/"){
$this->uri->uri_string="";
}
}或修改index.PHP如下:
<?PHP
//error_reporting(E_ALL);
/*這裡是判斷是不是CGI服務器且指向首頁是又重定向的路徑 */
if (substr ( PHP_sapi_name (), 0, 3 ) == 'CGI' and ! $_SERVER ["REDIRECT_QUERY_STRING"]) {
$url = "http://" . $_SERVER ["HTTP_HOST"] . $_SERVER ["REDIRECT_URL"];
require_once APPPATH . "config/routes.PHP";
$controller = $route ['default_controller'];
$refresh = $url . "?" . $controller;
echo '<meta http-equiv="refresh" content="0; url=' . $refresh . '" />';
}require_once BASEPATH.'codeigniter/CodeIgniter'.EXT;////修改完成
備注:用apache重定向會導致其它頁面不能正常訪問,而改Router.PHP類又加載不到,所以才想到這種方法....