urlManager: a rule for everything but controllers ?

Hello :)

I'd like to add rules that apply only if the url is not calling an existing controller.

<paramX:everythingbutexistingcontroller> => 'ControllerY'

Currently i'm doing this by manually listing my controllers in a rule. Anyone knows a better way ? (or should i post it in the features request ?)


Extend CHttpRequest and override its init() method:

class BaseHttpRequest extends CHttpRequest {

 public function init()


    try {


    } 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:

'request' => array('class' => 'application.components.BaseHttpRequest')

Thank you :)