WordPress.org

Forums

How to do url redirects to my WordPress site and alter landing page accordingly (3 posts)

  1. brianws
    Member
    Posted 2 years ago #

    I would like to have some of my unrelated URLs, say bobswebsite.com/home
    and maryswebsite.com/index redirect to my site, mywordpresssite.com/landingpage. And I want mywordpresssite.com/landingpage to then dynamically display the top part
    of the page to show "Bob's Website" or "Mary's Website" depending on which link the user had previously clicked on. How hard is this to do in WordPress? Can a novice to do this or is it strictly for professionals only? Thx.

  2. catacaustic
    very awesome
    Posted 2 years ago #

    It is possible, and it's not that hard. You can use something like this in your template files:

    <?php
    if (strpos ($_SERVER["HTTP_REFERRER"], "bobswebsite.com") !== false) {
        // Bob's website
        get_header ("bobs");
    }
    elseif (strpos ($_SERVER["HTTP_REFERRER"], "maryswebsite.com") !== false) {
        // Mary's website
        get_header ("marys");
    }
    else {
        // Default header
        get_header ();
    }
    ?>

    Then you'd set up three header files.

    header.php
    header-bobs.php
    header-marys.php

    That lets you put the individual code for each referrer in each header.

    Of course there's other ways of doing this, but that's a quick and easy starting point.

  3. brianws
    Member
    Posted 2 years ago #

    thx!

Topic Closed

This topic has been closed to new replies.

About this Topic