I am still working on the redirection issue (As noted in a previous thread here).

I think I may have found a nice solution via a video tutorial on the subject.

When running this test script, it should simply load google.com; The result though is a "Page not found" screen.

Please look at my code.

<?php
ob_start();
?>

<h1>ob redirect test</h1>
Hi

<?php
$redirect_page = 'https://www.google.com';
$redirect = true;

if ($redirect = true) {
    header('Location:$redirect_page');
}

ob_end_flush();
?>

Thank you in advance for your assistance!
Matthew

Recommended Answers

Change line 12 to:

if ($redirect === true) {

And change the single quotes with double quotes on line 13:

header("Location:$redirect_page");

Docs: http://www.php.net/manual/en/language.types.string.php#language.types.string.parsing

Jump to Post

All 3 Replies

cereal:

Works perfectly (And I learned more about proper syntax)!

You're awesome.

Thank you for your help, Friend.

Matthew

This will work, too:
header('Location:'.$redirect_page.'');

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.