我在我的项目中使用CI,当我在生产服务器上移动它时,我在调用$ this-> session-> set_flashdata时看到错误“找不到404页面”。在我清除cookie之前,当我请求任何页面时,会保留此错误。再次调用“set_flashdata”后会重复此错误。
function _set_success($message)
{
$this->session->set_flashdata('is_db_msg', 1);
$this->session->set_flashdata('db_msg', $message);;
}
$result = $this->page_model->edit_page($page_name, $this->_get_data_array());
$result ? $this->_set_success('OK') : $this->_set_error(DB_ERROR);
redirect(BASEURL.'admin/pages');
//重定向后的服务器404(在任何页面上)
BASEURL它是常数:DEFINE('http://mysite.com'); 我也在使用这个.htaccess:
DirectoryIndex index.php
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www [NC]
RewriteRule ^(index\.php/?)?(.*[^/])/?$ http://mysite.com/$2 [L,R=301]
RewriteCond %{HTTP_HOST} ^www [NC]
RewriteRule ^$ http://mysite.com [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(index\.php/?)?(.+)/$ /$2 [L,R=301]
RewriteCond %{ENV:REDIRECT_FINISH} ^$
RewriteRule ^index\.php/(.*)$ $1 [L,R=301]
RewriteRule ^(main/index(/index)?|index(\.php)?)/?$ / [L,R=301]
RewriteRule ^([^/]*)/index/?$ $1 [L,R=301]
RewriteCond %{REQUEST_URI} ^(system|application).*
RewriteRule ^(.*)$ /index.php/$1 [L,E=FINISH:END]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L,E=FINISH:END]
请帮助,抱歉我的英语不好。
答案 0 :(得分:1)
You should use following for redirecting:
redirect('admin/pages');
or
redirect(base_url().'index.php/admin/pages');
or
DEFINE('BASEURL','http://mysite.com')
redirect(BASEURL.'index.php/admin/pages');