I'm trying to redirect other websites that contain a specific word in the hostname. I use the following code in my vhost file:
if ($http_referer ~* "hostname1|hostname2" ) {
rewrite ^ http://www.example.com;
}
Only problem is, its matching even pages on my site that contain the text. What do i use so it only matches hostnames (the text before the TLD) ?