WordPress.org

Support

Support » How-To and Troubleshooting » How to do url redirects to my WordPress site and alter landing page accordingly

How to do url redirects to my WordPress site and alter landing page accordingly

  • 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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • catacaustic

    @catacaustic

    very awesome

    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.

    thx!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to do url redirects to my WordPress site and alter landing page accordingly’ is closed to new replies.
Skip to toolbar