View Full Version : Curious, Why did they call it Header
08-14-2007, 11:40 AM
To redirect, or go to another page you use header();
To me that sounds like a heading, header, and head, of a page.
Footing, Footer, foot.
Is header the only one to redirect?
I just wonder because it seems weird.
This isn't ActionScript but it seems more logical to say GoToFrame(); and the like. Sorry the PHP Manual doesnt tell me WHY they do what they do all the time.
When you make a request to a web-server for a page, it gives you back (normally, for a '200' successful request) 2 things, the 'content' of the page you requested, and a 'header' that contains meta-information, such as the content-type (whether it's HTML, a word document, an image etc.), when the page should expire (to help things get cached for a sensible amount of time), and so on.
When you want to redirect, you send back a header with a '3XX' status code (http://en.wikipedia.org/wiki/List_of_HTTP_status_codes) indicating to the client (the web-browser) that there's not actually any content at the location they requested, but if they try somewhere else, they'll get it. That somewhere else is the 'location' that you include as part of the redirect.
header() then, isn't just for redirecting (although that is very common), but allows you to set arbitrary http-headers that can affect how the content your serving is treated by the client.
08-14-2007, 01:31 PM
You can use this (http://serverheader.com) site to see what HTTP headers servers are sending.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.