Sign up ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have a 404 file and it is working with nginx. However when I modify the 404 file to redirect the user it does not redirect.

visiting redirects the user.

visiting is just a blank page.

The code in the 404 file is just a header redirect,


Why doesn't this work in nginx?

share|improve this question
Try removing the php from the 404.php file add some basic text, then visit and see if you can view the text. If yes, then try using php echo to display the same text and see if that works. Are you using PHP FastCGI – Anagio Jun 8 '12 at 9:29
And look in your PHP error log. A space before the first <?php would cause these symptoms and would leave messages about it in your error logs. – Ladadadada Jun 8 '12 at 22:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.