302找到的文档已与CodeIgniter一起移动 [英] 302 Found Document Has Moved with CodeIgniter
问题描述
我正在使用codeIgniter开发定制的CMS.它可以在我的本地主机和bluehost的帐户上正常运行.现在,我已将该网站上传到ipage,但出现了一个奇怪的错误
I am working on a custom built CMS with codeIgniter. It works flawlessly in my localhost and on a account at bluehost. Now I have uploaded the site to ipage i get a strange error
0<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="http://igncms.safaapps.com/admin/login">here</a>.</p>
<p>Additionally, a 302 Found
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>
HTTP/1.1 200 OK
Date: Sat, 18 May 2013 15:08:04 GMT
Content-Type: text/html
Content-Length: 3897
Connection: keep-alive
Server: Apache/2
X-Powered-By: PHP/5.2.17
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<title>Lazy Admin | Login</title>
<meta name="description" content=""/>
<meta name="viewport" content="width=device-width"/>
<link rel="stylesheet" href="http://igncms.safaapps.com/css/admin/bootstrap.min.css"/>
<link rel="stylesheet" href="http://igncms.safaapps.com/css/admin/bootstrap-responsive.min.css"/>
<link rel="stylesheet" href="http://igncms.s
这正是我所看到的,我注意到在输出的开头有一个0.我不确定从哪里开始.
This is what exactly i see, I notice there is a 0 at the beginning of the output. I am not sure where to start.
更有趣的是,它仅在某些时间发生,我还没有弄清楚什么时候出现,但是它随机出现,随后是某种请求(例如,表单提交,重定向等),并且在刷新页面后就消失了.
More interesting is that it happens only certain times, i havent figured out when but its randomly appearing followed by some sort of request (for example form submit, redirect etc.) And it just disappears on a page refresh.
这已成为主要的头痛问题,我必须将30多个网站上传到ipage主机.我不知道从哪里开始解决问题.
Its becoming a major head ache cz i have to upload 30+ sites to the ipage host. I have no clue where do i start to solve the problem.
注意:
url: http://igncms.safaapps.com/我的网址指向/igncms/
url: http://igncms.safaapps.com/ My url is directed to /igncms/
cms文件夹的htaccess-
htaccess of the cms folder -
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
codeIgniter的路由配置
Route config of codeIgniter
$route['default_controller'] = "home";
$route['admin'] = "admin/dashboard";
$route['404_override'] = '';
请注意,仪表板控制器位于application/controller/admin/dashboard.php(controller文件夹内的文件夹)的路径为.
note that dashboard controller which is located in application/controller/admin/dashboard.php ( a folder within controller folder) has a route .
我已经缩小了问题是由htaccess引起的.有人可以指示我输入适当的htaccess声明,以从CI 2.1.2隐藏index.php吗?
I have narrowed down that the problem is caused by htaccess. Can anyone indicate me to a proper htaccess declaration to hide index.php from CI 2.1.2?
问我,我将提供所有信息.我需要尽快解决这个问题
Ask me and i will provide all information . I need this sorted out ASAP
推荐答案
我的问题终于通过以下设置得到解决
My problem was finally solved by the following settings
这是新的-
/*config.php*/
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
/*routes.php*/
$route['default_controller'] = "home";
$route[''] = "home/index";
$route['admin'] = "admin/dashboard";
$route['home'] = "home/index";
$route['404_override'] = '';
/*min htaccess*/
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
这篇关于302找到的文档已与CodeIgniter一起移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!