Page 1 of 1

Go to a page with php

Posted: Thu Jan 24, 2008 7:17 am
by Sindarin
Is there any other way except echoing meta refresh tags and header to direct the user to another page from a php script?
server-side is always preferred.

Re: Go to a page with php

Posted: Thu Jan 24, 2008 7:58 am
by Zoxive

Code: Select all

header("Location: http://www.mysite.com/mypage.php");
What's wrong with header? That is server side.

Re: Go to a page with php

Posted: Thu Jan 24, 2008 8:31 am
by Sindarin
My server outputs a 500 server error, whenever I try to use it for files that are on the server (index.html) but not for external links (e.g. http://www.google.com).

Re: Go to a page with php

Posted: Thu Jan 24, 2008 8:35 am
by Zoxive
You need to use full paths. Like my example.

Re: Go to a page with php

Posted: Thu Jan 24, 2008 5:30 pm
by Jonah Bron
Also, I think this works...

Code: Select all

header('REFRESH', '0;URL=http://someaddress.com/some_file');

Re: Go to a page with php

Posted: Fri Jan 25, 2008 12:41 am
by Chris Corbyn
PHPyoungster wrote:Also, I think this works...

Code: Select all

header('REFRESH', '0;URL=http://someaddress.com/some_file');
No it won't. Header sends a HTTP header and it's just the first argument which contains the string. The second is a boolean.

http://au2.php.net/header