Ah ok... e prova con qualcosa del genere

Codice PHP:
if (substr(strtolower($url), 011) != 'http://www.')
{
    
$url 'http://www.' str_replace(array('http://''www.'), ''$url);

oppure usa il codice di prima ma adattalo affinché cerchi ed eventualmente aggiunga anche il "www."