How do I send HTTP headers with PHP?
Here is an example of using header to re-direct to a different webpage:
<?php
header("Location: http://www.php-questions.com");
?>
There are two mistakes that everyone makes with header the first time they use it so since we're feeling nice, we'll tell you up front to stop some head scratching.
First, the header command must be called before anything is sent to the web browser, otherwise a nice error message will occur.
Second, you'll want to stop execution of the script after the header call, so be sure to include exit; directly underneath. We just saved you a whole load of hassle!
Comment on this Question and Answer >>>
ASK A QUESTION
More website PHP Questions
How do I perform a 301 redirect with PHP?How to expire cookies when user pressed a button in webpage? I want have a link in my website then delete cookies.
Hello - I am writing a PHP program to control an external camera connected to the USB port. For example I issue commands such as 'up', 'down', etc via an external program that I call using exec("cameracontrol.exe"). I would like to store
I have two web solutions I downloaded from the internet. Jobs Portal, Classified and a forum script. Each of the scripts has its own signup and log in module. How can I make visitors register and login through one webpage without having to login in all th
how to display only product image with product name in 4 column set from mysql database?
