Show Content Only To Visitors Coming From a Search Engine
Displaying a message to visitors coming from search engines can sometimes be beneficial. It can allow you to show them targeted links on where to go to next or perhaps increase the call to action on the page that they land on. Either way, it allows you to more specifically build a website based on the nature of the users that visit it.
Showing the content is just a matter of using a little PHP snippet that looks for the URL of common search engines from the referrer agent that is passed along to the server. If it matches, we display the content that you want and if it doesn’t, we don’t: Simple!
<?php
if (preg_match(’/^http:\/\/(\w+\.)?(google|bing|yahoo|aol|ask)\./’,$_SERVER[’HTTP_REFERER’]) == 1) :
?>
Content that you want displayed to search engine visitors only should go right here.
<?php endif; ?>