I’m trying to use a plugin to set up a site route that will direct every page request to a special template.
This is what I’ve set up in my plugin file.
public function registerSiteRoutes()
{
return array(
'*' => 'special/index',
);
}
Using the above doesn’t seem to do anything. If I replace * with a word, then try to visit that URL I get something different but not my template. would love it if someone could put me right here
UPDATE If I change tact a bit and route to a controller using a specific url then I can see it gets there
public function registerSiteRoutes()
{
return array(
'beer' => array('action'=>'beer/index'),
);
}
But I can't figure out how to catch all requests using *
doesn't appear to do anything
UPDATE @robin helped me out massively here with some more info outside the comments.
Basically in Craft 2 the plugin routes get called first no matter what. So I can hijack the init method to load my special template
UPDATE 2 I made this into a Craft 2 plugin. https://github.com/moresoda/craft-emergency-mode
Craft 3 plugin coming soon.