well, you are using OR wrong, but that isn't the only problem. proper syntax would be the same as using AND:

PHP Code:
if(condition || other_condition)

//or:

if($name == "david" || $name == "something_else"
but, remember that an OR means that either of these conditions can be true an the IF statement will trigger.

the other problem is the way you're trying to evaluate the host. look at the above code, then look at your edited code. $referer['host'] doesn't look at the protocol scheme -- it looks at the host. the host is equal to "mydomain.com" -- it wouldn't have the protol attached like you've tried to do. you could do something like:

PHP Code:
<?php
  $protocol 
parse_url($urlPHP_URL_SCHEME); //save for later
  
$host parse_url($urlPHP_URL_HOST);

  if(
$host != "mydomain.com && $host != "www.mydomain.com"){
    header("
Location: {$protocol}://www.mydomain.com/");
  
}
?>
that might be better for what you want?