Connecting Tech Pros Worldwide Forums | Help | Site Map

how to redirect a webpage in php

Newbie
 
Join Date: Jan 2007
Posts: 4
#1: Jan 16 '07
how to redirect a webpage in php

acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#2: Jan 16 '07

re: how to redirect a webpage in php


[PHP]<?php
header('Location: http://www.yoursite.com/yourpage.php') ;
?>[/PHP]
This must appear before anything else on the page otherwise the redirect will not work.
ronverdonk's Avatar
Moderator
 
Join Date: Jul 2006
Location: The Netherlands
Posts: 4,139
#3: Jan 16 '07

re: how to redirect a webpage in php


I hope you mean 'any headers' or 'any output'.

Ronald :cool:
NSR NSR is offline
Newbie
 
Join Date: Jan 2007
Location: India,Andhra,Hyd
Posts: 2
#4: Jan 17 '07

re: how to redirect a webpage in php


I hope u meet ur requirement by this....


header("Location: ./to the page u like to ridirect");
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#5: Jan 17 '07

re: how to redirect a webpage in php


Quote:

Originally Posted by ronverdonk

I hope you mean 'any headers' or 'any output'.

Ronald :cool:

Yes, that's more precise.
Newbie
 
Join Date: Nov 2006
Posts: 6
#6: Jan 18 '07

re: how to redirect a webpage in php


if you want redirect the page in your project then
<?php
header("location:yourpage.php");
?>

if you want redirect the page in another project then just put the url like

<?php
header("location:http://www.yoursite.com/yourpage.php");
?>
Newbie
 
Join Date: Jan 2007
Posts: 2
#7: Jan 18 '07

re: how to redirect a webpage in php


You can find everything you need at
http://us2.php.net/header

good luck
ozgur uksal
Reply