OZONE Asylum
FAQ
How can I redirect a page with PHP?
This page's ID:
5038
Search
QuickChanges
Forums
FAQ
Archives
Register
You are editing "How can I redirect a page with PHP?"
Who can edit an FAQ?
Anyone registered may edit an FAQ.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
With credits to mr.maX. Adjust the code below to suit your needs. [code] <?php header("Refresh: 3; URL=/index.phpnn"); echo " "; // NN4 requires that we output something... exit(); ?> [/code] If you didn't want a timed redirect then you could use this: [code] header("Location: ADDRESS");[/code] Make sure that you do not output to the browser before you perform the redirection. Your attempt at redirection will fail if you output anything with a message similar to [quote]Cannot modify header information - headers already sent by (output started .....)[/quote] This means that the redirection must be found before any HTML code. This includes newlines in any includes you may have, or newlines before the first <?php. -------------------------------------- Relevant FAQs: [5257] [5258] [5290] [22098] ---------------------------- Relevant note: As of writing this FAQ is number 2 at Google in the search for the terms [url=http://www.google.com/search?q=php+redirect]php, redirect[/url] (up from 9) and 9 for the terms [url=http://www.google.com/search?q=php+redirect+page]php, redirect, page[/url] (previously 14). ___________________________ [small](Edited by [internallink=1424]Tyberius Prime[/internallink] on 06-09-2004 16:31)[/small]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »