Welcome Guest, Not a member yet? Register   Sign In
set_status_header('404');
#1

[eluser]ci_user[/eluser]
On IIS 7, unable to output anything or load a view after setting a 404 header.
Code:
function custom_404 () {
$this->output->set_status_header('404');
//or header("HTTP/1.0 404 Not Found");
//or header("Status: 404 Not Found");
$this->load->view('my_error');
//or die("Page not found");
}

The header is set to 404 but all I get is a blank page.

This issue has been discussed without resolution here:
http://ellislab.com/forums/viewthread/218935/#1009898

#2

[eluser]Ochetski[/eluser]
Tested

$this->output>set_output($this->load->view('my_error', true));

yet?
#3

[eluser]ci_user[/eluser]
[quote author="Ochetski" date="1339436994"]Tested

$this->output>set_output($this->load->view('my_error', true));

yet?[/quote]

Do you mean like:
Code:
$this->output->set_status_header('404');
$this->output>set_output($this->load->view('my_error_view', true));

That generates a server 500 error.
#4

[eluser]CroNiX[/eluser]
2nd parameter to load:view() is supposed to be an array, not a boolean
#5

[eluser]ci_user[/eluser]
Update: Appears to be an IIS issue (surprise). IIS apparently won't do a second http request after a 404 status is set. Instead, it will look for the file specified in IIS as the custom error page.

Read about it in this thread:
http://ellislab.com/forums/viewthread/204507/#954058




Theme © iAndrew 2016 - Forum software by © MyBB