I'm migrating realurl configuration for extension news to route enhancers. The realurl configuration is a mix of fixedPostVars
and postVarSets
. Therefore speaking urls of news single views are build in two different ways:
- https://example.org/my-news-list-page/single-view-page/my-news-title
- https://example.org/my-news-list-page/single-view-page/news/my-news-title (including a
postVarSets
prefix named news)
Now with route enhancers I would like to have all links built without the prefix but still be able to resolve links with or without the prefix.
In my route enhancers configuration I added the following two routePaths in this exact order which seems to work just fine:
- { routePath: '/news/{news-title}', _controller: 'News::detail', _arguments: {'news-title': 'news'}}
- { routePath: '/{news-title}', _controller: 'News::detail', _arguments: {'news-title': 'news'}}
In a reversed order this is not working as links are built with the prefix. I'm wondering if the processing order of routePaths is reliable. Is using routePaths this way a good idea? Or should I better use redirects on webserver level which would be much more work?