I am trying to display content in a custom template based on referral URL. I put a link in my footer called http://domain.com/?ref=special and image2.gif shows still when I click it and go to the page. I need image1.gif to show if there is traffic coming from a domain that ends with ?ref=special. How can I do this and what am I missing?
<?php
$ref1 = parse_url(wp_get_referer()); //getting the referring URL
if($ref1["path"]=='/?ref=special/')
:?>
<div id="featured_image_small" style="background: url('<?php echo esc_url( home_url( '/wp-content/uploads/2015/05/image1.gif' ) ); ?>') no-repeat scroll 0 0 transparent; background-size:cover;">
<?php else: ?>
<div id="featured_image_small" style="background: url('<?php echo esc_url( home_url( '/wp-content/uploads/2015/04/image2.jpg' ) ); ?>') no-repeat scroll 0 0 transparent; background-size:cover;">
<?php endif ;?>
if
test seems wrong, why would there be a trailing slash?