ExpressionEngine 2.8's introduced Template Routes
so you now have more control over how your templates are processed. It allows you to override the default template route, which is /template_group/template
.
For example instead of going /blog/read/url_title
you can now add a template route for read.html
in the blog
template group to load like /blog/url_title
- skipping that middle segment.
However, what you are asking for wouldn't be possible with Template Routes. That's because if you have a dynamic segment in your route then that route must end with a dynamic segment.
So for example: /blog/{entry_title}/
is accepted, but /blog/{entry_title}/preview
is not because the dynamic variable ({entry_title}
) is BEFORE the final variable which isn't dynamic.
If we take your desired URLs they would look like this in template routes:-
- _view/index.html ->
/{entry}/
- _admin/index.html ->
/{entry}/admin/
- _admin/events.html ->
/{entry}/admin/events/
- _admin/communicate.html ->
/{entry}/admin/communicate/
BUT as you can see, it relies on the last segment being non-dynamic and so won't work natively in ExpressionEngine.
Trying to subvert how ExpressionEngine natively 'thinks' could lead to unnecessary complex code and the same basic result.
I would suggest that it's not worth the hassle or complexity trying to achieve your desired URL scheme and you would be better off doing the natively possible:-
- _view/index.html ->
/{entry}/
- _admin/index.html ->
/admin/{entry}/
- _admin/events.html ->
/admin/events/{entry}/
- _admin/communicate.html ->
/admin/communicate/{entry}/
With all that said, it would be great if Template Routes allowed for this, and perhaps it's something they'll implement later on.