0

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:

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?

tbsschmdt
  • 75
  • 6

1 Answers1

1

This should work.

If you are not redirecting you should think about duplicate content. I would check if EXT:seo is adding the correct canonical URL (which should be the first matching route) in order to make search engines are happy.

Yet I think this is a bit uncharted territory. Personally I would add a simple generic redirect to your webserver.

Jonas Eberle
  • 2,835
  • 1
  • 15
  • 25
  • Thanks for your helpful hints about duplicate content and EXT:seo. I think I'll stick to my solution for now as most links are already without prefix. I'll take a close look at statistics once the new configuration is live. If there's more than just a few page calls with the prefix I can still add webserver redirects. Otherwise I'll just remove the routePath with the prefix after a while. – tbsschmdt Jul 09 '20 at 08:51
  • 1
    With a clear canonical tag or redirect you can educate search engines of your preferred URL. Then after some weeks you can check their index and safely delete the old URL. – Jonas Eberle Jul 09 '20 at 10:24