4.1
Adding a custom routing
I am trying to create a custom routing to allow me to prefix all urls with a client stub so that I can have the following without having to duplicate pages in the site tree. (the client prefix will be used for changing the chrome of the page):
myurl.com/Client1 - maps to home in site tree
myurl.com/Client1/about-us - maps to about-us page in site tree
myurl.com/Client2 - maps to home in site tree
myurl.com/Client2/about-us - maps to about-us page in site tree
I am struggling with the routes. I have the following YAML defining my routes:
---
Name: modelascontrollerroutes2
Before:
- '#modelascontrollerroutes'
After:
- '#adminroutes'
- '#assetsroutes'
---
SilverStripe\Control\Director:
rules:
'': 'SilverStripe\CMS\Controllers\RootURLController'
'$Venue/$URLSegment//$Action/$ID/$OtherID': 'My\Namespace\CModelAsController'
Everything works fine on the front end (pages are mapped as above), going to /dev/build works fine as does going to /admin, the only issue I can see is that going to admin/assets produces “An unknown error has occurred”.
I presume that admin/assets has its own routing somewhere which I will need to place my rules after but I cannot work out what it is.
Any help would be greatly appreciated.