Quick Header function

SpaceshipSpaceship
Watch

phpwiz

Established Member
Impact
5
well im not sure if i am doing this right and i have seemed to forget how to do the header function where it will goto another page but just to make sure this is what i have

Header("http://bla.com");

thats what i got but if thats wrong tell me how the hell to do it lol. :hehe:
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
PHP:
Header("Location: http://bla.com");
Always leave a space after Location: in order to stick to the HTTP specs and avoid possible problems with some browsers
 
0
•••
In addition to the above, make sure that the header function gets called before any output is sent to the browser.... unless you are using output buffering (via the function ob_start().. in which case at the very end of the script or at some point you'll have to flush out the buffer using the function ob_flush() at which point the buffered output actually gets displayed in the browser).

also, the location header isnt the only one that you can use..... other types that are commonly used are ...

Last-Modified:
PHP:
header("Last-Modified: " . gmdate("D, d M Y H:i:s"))

this will indicate the last time the document was changed on the server.

You can also use the cache control header.. to tell the browser how to cache a page, like this:

PHP:
header("Cache-control: no-store, no-cache, must-revalidate ")

here we request the browser not to cache the page at all.

there are many other types.. and you can find more details on php.net ... just search around or download the php manual.....
 
0
•••
Dynadot — .com TransferDynadot — .com Transfer
CatchedCatched

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back