faqts : Computers : Programming : Languages : PHP : Common Problems : Redirects

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

15 of 21 people (71%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

How can I redirect a to a page using 'header: Location' but point to a .php page as opposed to .html?

Dec 13th, 2003 07:50
Jon Kriek, Ben Udall, Howard Betsworth,


Simply specify the location response-header field with a .php file 
extension.
<?php
    ob_start();
    if(!headers_sent()) {
        header('Location: http://example.com/page.php');
        exit();
    }
    ob_end_flush();
?>