redirect to different page in PHP [duplicate]
Possible Duplicate:
PHP page redirect
I have 0 experience with PHP. I was setting up a blog in wordpress which is in PHP.
In a page there are includes. Now I do I redirect users from page to the other.
For example: When users visit pics.php I want to redirect them to Gallery.php
You can redirect the users browser via the header()
function:
header( "Location: gallery.php" );
You will need to ensure that no output has been sent before this line (check for echo
and print
statements, as well as anything that may produce errors or warnings).
See header:
header('Location: http://domain.com/Gallery.php');
Read manual for header.
If the Location header is modified, the browser will make a new request to the specified URL.
header('Location: /Gallery.php');
Just use
header('Location: /pics.php');
or
header('Location: http://www.mydomain.com/header.php');
精彩评论