How to create catch-all module route
- kevin.waterson@gmail.com
- Member | 81
My module directories look like this:
I would like to create a catch-all route, where a url, such as http://example.com/blog would load the BlogModule and http://example.com/contact would load the ContactModule, and the default, if no module is specified, or the url is not found, defaults to the DefaultModule.
I have tried using this:
code
The above routes work, however, the last route forwards the url to http://example.com/default/default.
Is there a way to have routes dynamically loaded, so a route is not required for
all possible variations?
Is something needed in .htaccess which currently looks like this:
- kevin.waterson@gmail.com
- Member | 81
Thanks David.
This works for /blog and for /contact, however, the default (eg: http://example.com) gives
this error:
Cannot load presenter 'Default', class 'App\Presenters\DefaultPresenter' was not found.
However, http://example.com/default does load the default presenter.
So, this seems to do what I need
code
But then, if a non-existent value is given, it gives a 404, rather than return to the default.. but I think this is another question, so will start another thread.
Last edited by kevin.waterson@gmail.com (2019-11-14 01:47)