Hello,
I am trying to build an URL shortner as simple as possible. I have come with the idea of two controllers:
- SiteController with a number of actions – for managing the service
- DefaultController with just a single
index
(default) action – for actual redirection
How should I configure urlManager component / write it’s rules so that:
- any route to SiteController (+any error, internal Yii routes etc.) would be served normally,
- any other route would be redirected to the other controller’s default action
In addition routes to the second controller must be hidden from URL, so:
- example.com/site/generate → view
- example.com/site/about → view
- example.com/site/error → view
- example.com/sdgwu → URL redirect
- example.com/18jfs → URL redirect
etc.
How to build urlManager rules to achieve the above? Thank you.