shababhsiddique shababhsiddique - 1 year ago 137
PHP Question

302 Found Document Has Moved with CodeIgniter

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

<title>302 Found</title>
<p>The document has moved <a href="">here</a>.</p>
<p>Additionally, a 302 Found
error was encountered while trying to use an ErrorDocument to handle the request.</p>
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]-->
<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=""/>

<link rel="stylesheet" href=""/>
<link rel="stylesheet" href="http://igncms.s

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.

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.


My url is directed to /igncms/

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]

Route config of codeIgniter

$route['default_controller'] = "home";
$route['admin'] = "admin/dashboard";
$route['404_override'] = '';

note that dashboard controller
which is located in application/controller/admin/dashboard.php ( a folder within controller folder) has a route .

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

Answer Source

My problem was finally solved by the following settings

This one was new-


$config['index_page'] = ''; 
$config['uri_protocol'] = 'REQUEST_URI'; 

$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] 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download