PHP-Code:
<?PHP
  
if ( substr $_SERVER['SERVER_NAME'], 0) != 'www.' )
  {
    
header 'location: http://www.' $_SERVER['SERVER_NAME'] );
    exit ();
  }
?>