2 Votes Vote

php redirect not working with Nginx

Posted by topdog 580 days ago Questions| php nginx working All

Simple problem:

I have conditions in php like so:

if (!$authorized)
   show_site_404();

or like so for that matter

if (!$logged_on)
    show_login_page();

These are obviously toll gates so that we don't have trespassers into parts of the system where only a specific user or only those that are logged on should be able to go.

The code in both these cases simply loads another page than that which was intended by

require( MAINPATH . 'site-404.php' );
exit();

With Apache, this was never a problem. No settings needed.

With Nginx, it sends all such calls to the frontpage. It's like it doesn't accept an internal "re-direct" if you see what I mean.

Any help appreciated.

Originally asked by: Adergaard on Stack Overflow

Discuss Bury


Who Voted for this Question