Redirect to another web page using PHP
Redirection from one web page to another is a handy tool. This recipe describes the syntax that causes the client to redirect to another URL.
The following php script redirects the user to /index.php within the same site:
<? header('Location: /index.php'); ?>
The redirection target can be any suitable URL as could be used in the href parameter of an address tag (such as http://www.tech-recipes.com/index.php). The header function sends raw header data to the client web browser and in this case sends a 302 status code which instructs the browser to redirect to the given location.






Add New Comment
Viewing 3 Comments
Thanks. Your comment is awaiting approval by a moderator.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Add New Comment