hai guys, how to redirect to another page in php?plz help me....
header("location:filename");
die();
it must be called before anything else is output.
Edit: Check out the original question mentioned in the comment, there are way more detailed explanations there.
before any output is done do this:
header('location:myPage.php'); exit; // avoid any unnecessary procedures
You could have found that easily by googling it
header( "HTTP/1.1 301 Moved Permanently" );
header( "Location: http://www.new-url.com" );
exit;
Easy.
<?php
header('Location: /yournewurl/');
?>
If you also need to specify a HTTP status code then you'll need to specify that too. But given the simplistic nature of your question I'll presume you don't know what a HTTP status code is. Therefore, if this a permanent redirect, i.e. you want to remove this page but send everyone to a new page in its place, then you want to use a HTTP status code of 301.
If the redirect is only for a set amount of time (e.g. whilst you're performing site updates) then you'll want to send a status code of 302.
See Gordon's answer above for the syntax of those types of redirects.
It is really cheezy (and really has nothing to do with PHP, but when I forward to a page in a PHP file, I do it with Javascript like so:
?>
<script language="Javascript">
location.href='URL_TO_FORWARD_TO';
</script>
<?php
The PHP tags allow existing PHP code to exist around this block.
Just a thought. PEACE!!!!!!!