adam_ Posted September 30, 2008 Share Posted September 30, 2008 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! Quote Link to comment https://forums.phpfreaks.com/topic/126458-using-the-header-function-as-a-404-redirect/ Share on other sites More sharing options...
genericnumber1 Posted September 30, 2008 Share Posted September 30, 2008 You need to redirect them to the 404 page and use the header on the page to which you redirected the user. Quote Link to comment https://forums.phpfreaks.com/topic/126458-using-the-header-function-as-a-404-redirect/#findComment-653894 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.