Extend CHttpRequest and override its init() method:
class BaseHttpRequest extends CHttpRequest {
public function init()
{
try {
parent::init();
} case (CHttpException $e) {
if ($e->statusCode == 404)
//do your stuff if the requested site does not exists
} else {
throw $e;
}
}
}
}
In you main confiuration you provide the new request class in the components part: