CodeIgniter项目在上传在线服务器时显示错误

时间:2018-05-09 13:06:56

标签: .htaccess codeigniter

enter image description here

.httaccess代码:

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

我的项目在本地主机上运行良好,但是当我在托管服务器上传项目时,它显示错误。图中提到了错误。 我附上了我的.htacces文件,请指导。

1 个答案:

答案 0 :(得分:-1)

.httaccess就像吼叫:

RewriteEngine on
RewriteCond $1 !^(index\.php|public|\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1

并将config.php设置为以下代码:

//$config['base_url'] = '';
$config['base_url'] = ((isset($_SERVER['HTTPS']) &&       $_SERVER['HTTPS'] == "on") ? "https" : "http");
$config['base_url'] .= "://".$_SERVER['HTTP_HOST'];
$config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);

see more here ...