Reputation: 1034
For some reason I can't spot, redirect in codeigniter is not working. I'm getting the white screen of death.
I set up a "test" controller:
class Test extends Controller {
function Test() {
parent::Controller();
$this->load->helper('url');
}
function index() {
redirect('home','refresh');
}
}
(I've tried the location and refresh parameters, with no help).
Here's my .htaccess file:
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
I've used all this before with good results. Anything else I can check?
Thanks.
John
Upvotes: 5
Views: 13397
Reputation: 1034
As it turned out, setting the log threshold to 4 was the answer to figuring this out. I was able to determine that I was outputting some space, which prevented the redirect from working. Looking in the logs revealed this.
Thanks everyone for your help, and thanks Madmartigan for suggesting the log setting.
Upvotes: 10
Reputation: 770
Try adding a ? at the end of index.php in your last rewrite rule as such:
RewriteRule ^(.*)$ ./index.php?/$1 [L,QSA]
If that doesn't work, try changing your $config['uri_protocol']
(if it's set to AUTO
) to:
$config['uri_protocol'] = 'REQUEST_URI';
Upvotes: 1