shababhsiddique shababhsiddique - 13 days ago 8
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

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


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.

NOTES:

url: http://igncms.safaapps.com/
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]
</IfModule>


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

My problem was finally solved by the following settings

This one was new-

/*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>
Comments