Redirect visitors only from Yelp.com

I would like visitor from my yelp listing to land on a different page of my website.

For example: On yelp.com my website URL is domain.com. But when the visitor clicks on that URL, they should be redirected to domain.com/newpage

Read More

I am trying to do this only for the visitors who come to my website through yelp. How is this possible?

Related posts

3 comments

  1. 1st way is change the url as suggested in comment.

    2nd is :

    $url = $_SERVER['HTTP_REFERER'];
    if (strpos($url,'yelp') !== false) {
        header("Location : YOUR_PAGE_URL");
    }
    
  2. Check the server variable

    $_SERVER["HTTP_REFERRER"]

    in the landing page of your website.

    If the host is yelp.com, then redirect to your desired page.

    Be sure to sanitize the value before using it. A malicious user could take advantage of this.

  3. You could also add a variable to the url, so it goes to the normal landing page, or /newpage depending on that variable.

    domain.com?from=Yelp
    

    Then on your landing page:

    <?php
    
    if($_GET["from"] == "Yelp"){
        header('Location: http://www.domain.com/newpage/');
    }
    
    ?>
    

Comments are closed.