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
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 thHow do I perform a 301 redirect with PHP?
Hi, I need to fetch data from a web page with PHP. The only problem that I face is that I need to log in with name and password.
How to run a php script on different browsers?
where do i go to paste my google adsense code?
