Contao: All routes are registered twice?

Created on 30 Jul 2020  Â·  1Comment  Â·  Source: contao/contao

Affected version(s)

Contao 4.10

Description

  tl_page.12                             ANY      https    managed-edition.wip   /en/your-data-has-been-saved{!parameters}.html           
  tl_page.64                             ANY      https    managed-edition.wip   /en/user{!parameters}.html                               
  tl_page.31                             ANY      https    managed-edition.wip   /en/top-menu-folder{!parameters}.html                    
  tl_page.32                             ANY      https    managed-edition.wip   /en/sitemap{!parameters}.html                            
  tl_page.14                             ANY      https    managed-edition.wip   /en/search{!parameters}.html                             
  tl_page.2                              ANY      https    managed-edition.wip   /en/index{!parameters}.html                              
  tl_page.60                             ANY      https    managed-edition.wip   /en/faq{!parameters}.html                                
  tl_page.59                             ANY      https    managed-edition.wip   /en/events{!parameters}.html                             
  tl_page.70                             ANY      https    managed-edition.wip   /en/event-detail{!parameters}.html                       
  tl_page.51                             ANY      https    managed-edition.wip   /en/content-elements/text-elements{!parameters}.html     

  tl_page.12.locale                      ANY      https    managed-edition.wip   /your-data-has-been-saved{!parameters}.html              
  tl_page.64.locale                      ANY      https    managed-edition.wip   /user{!parameters}.html                                  
  tl_page.31.locale                      ANY      https    managed-edition.wip   /top-menu-folder{!parameters}.html                       
  tl_page.32.locale                      ANY      https    managed-edition.wip   /sitemap{!parameters}.html                               
  tl_page.14.locale                      ANY      https    managed-edition.wip   /search{!parameters}.html                                
  tl_page.2.locale                       ANY      https    managed-edition.wip   /index{!parameters}.html                                 
  tl_page.60.locale                      ANY      https    managed-edition.wip   /faq{!parameters}.html                                   
  tl_page.59.locale                      ANY      https    managed-edition.wip   /events{!parameters}.html                                
  tl_page.70.locale                      ANY      https    managed-edition.wip   /event-detail{!parameters}.html                          
  tl_page.51.locale                      ANY      https    managed-edition.wip   /content-elements/text-elements{!parameters}.html        

IIRC, there is a redirect route "no locale → locale" for every single page now, which was not the case in Contao 4.9 (routes look like /{_locale}/content-elements/text-elements{parameters}.html there). IMHO, we only need the "no locale → locale" redirect for the empty domain. Otherwise we will end up with a large number of routes (number of pages * number of languages).

bug

Most helpful comment

Yes, every page can have multiple routes, depending on your configuration. If you have a url prefix, every route exists again with a redirect if the user does not enter the language. Thats how www.contao.org/partners.html will/might redirect you to www.contao.org/de/partners.html. Every root/index page has a route with and without url prefix and/or alias etc.

However, please be aware that these routes do not really exists at the same time in a normal flow. You are looking at the debug information, only in debug mode all routes are generated (to - hahah - let you debug and see them). In a regular flow, only routes for pages matching the request path are generated. Only if none of that match the _404 router_ will try to generate a locale redirect, or lastly resort to generating the 404 error page route.

>All comments

Yes, every page can have multiple routes, depending on your configuration. If you have a url prefix, every route exists again with a redirect if the user does not enter the language. Thats how www.contao.org/partners.html will/might redirect you to www.contao.org/de/partners.html. Every root/index page has a route with and without url prefix and/or alias etc.

However, please be aware that these routes do not really exists at the same time in a normal flow. You are looking at the debug information, only in debug mode all routes are generated (to - hahah - let you debug and see them). In a regular flow, only routes for pages matching the request path are generated. Only if none of that match the _404 router_ will try to generate a locale redirect, or lastly resort to generating the 404 error page route.

Was this page helpful?
0 / 5 - 0 ratings