PHP Redirection Page

by 5 replies
6
Hi All,

I'm doing some testing using Google Website Optimiser and i have a problem which i wonder if you might be able to help me with.

Basically with website optimiser you need a common conversion page that all variations land at to track conversions.

My problem is this that the pages i want to test are all very different in design and have different conversion (thankyou) pages based on teh site design. So i'm wondering if i can put some sort of bridge page that all conversion come through to before being redirected to the thank you page.

so for example index1.html goes to conversion.php page which then redirects to thanks1.html
index2.html goes to conversion.php page then redirecting to thanks2.html

this would get over the issue of having one common conversion page.

I know to redirect a page i can use the following code:

<?php

header( 'Location: http://www.yoursite.com/new_page.html' ) ;

?>

But i need to add this to redirect specific incoming pages to different thank you pages.

Any ideas?

Thanks
#programming #page #php #redirection
  • [DELETED]
  • You could use a session variable. In index1.php you'd have:

    Code:
    session_start();
    $_SESSION['redirect'] = "thanks1.php";
    then in conversion.php you'd have:

    Code:
    header( 'Location: http://www.yoursite.com/'.$_SESSION['redirect'] ) ;
    Matt
  • Hi Matt,

    I'm not sure i quite understand you. Sorry i'm not a coder just trying to do a quick fix really.
    My main landing pages are HTML based. I'm not sure i quite understand how to implement what you are saying and how the redirect works.
  • You can pass a variable though the url.

    Like conversion.php?page=1

    So on index1.html you would link conversion.php?page=1

    Then your php script would redirect to the appropriate thank you page.

    A simple if() statement would be all that it takes.
  • For the redirection of pages in PHP you can use header() function.

    header('location': page url);

Next Topics on Trending Feed