Page 1 of 1

URL forwarding

Posted: Tue May 09, 2006 7:24 pm
by sheepz
i have a website www.website.com that i'm building but it's not done. so other pages are done but still working on the front end. so i want to be able to route all visitors to www.website.com/testing/index.php i tried using the header() but i'm guessing because i'm using meta tags it's sending out packets before the header and causing it to error out.

i need the http://www.website.com/index.php to stay there because i need the meta tags to populate thru the name servers and i'm currently working on it. is there a way i can have visitors come in and get re-routed automatically without clicking on any link? perferablely without any wait time. thanks :mrgreen:

Posted: Tue May 09, 2006 8:37 pm
by s.dot
Put your header calls before your meta tags

Code: Select all

<?php
header('location ...');
?>
<html>
<head>
<meta ...

Posted: Tue May 09, 2006 11:48 pm
by John Cartwright
scottayy wrote:Put your header calls before your meta tags

Code: Select all

<?php
header('location ...');
?>
<html>
<head>
<meta ...
fyi, always include an exit() call after any header to prevent other code from potentially being executed.

Posted: Wed May 10, 2006 10:27 am
by Oren
Jcart wrote:fyi, always include an exit() call after any header to prevent other code from potentially being executed.
Totally true, I use die() though (doesn't really matter :P).

Posted: Wed May 10, 2006 12:59 pm
by Maugrim_The_Reaper
die() is exit() - its an alias ;)

You can also use output buffering if placing headers above meta tags is too much trouble - http://ie.php.net/manual/en/ref.outcontrol.php

Posted: Wed May 10, 2006 1:07 pm
by Oren
Maugrim_The_Reaper wrote:die() is exit() - its an alias ;)
I know that :P

Posted: Wed May 10, 2006 8:05 pm
by sheepz
thx if i use the or die command i thought it wont read any code after that. it will still read the meta tags and other codes etc? i will go ahead and test that out. if i could ask one more question 8O

for future purposes, how would i code this, when a user enters a link or download, etc., and i want to re-direct them but i would want a wait time. like this site for instance. after posting, it will perform this: wait 5 seconds and it will re-direct you if not click here. hows that done? :D