Bu konunun yeri burası değil. Ayrıca kodda https veya httpli diye ayırmanıza hiç gerek yok.

Şu basit kod işi rahatlıkla görür..

if(stripos($referer, "google.com") !== false) 
header("Location:$siteadresi");