Jump to content

Using the header() function as a 404 redirect


adam_

Recommended Posts

Hi!

 

I have a database driven site, but at the moment when a bad request is given, there is just a message saying "sorry no records found"

 

I have changed it a bit so that there is a header() redirect, and my plan is to respond with 404 and serve a nice looking 404 page with a sitemap on it for my users.

 

I can't seem to figure out how to do this though:

 

header('HTTP/1.0 404 Not Found');

 

Does not work, and the page loads as normal, which is not what I want. Weirdly if I change to Location: type header redirect it works as i expect.

 

If anybody could let me know why this isn't working, I would be very grateful!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.