Not sure of this is intentional or a bug but, when we add a route using Settings -> Routes in the CMS, routes.php does not work. I guess maybe its due to us using a wildcard and this takes presedence over routes.php
The route we needed to add in the CMS was:
*/<teamid>
The reason we need a wildcard is because I don't want to hard code the page slug as this could be changed by a website administrator which would break functionality.
I added it in the CMS Routes because I can't find out how to add a wildcard in routes.php (perhaps worthy of another question as I would like that answer too!).
in the meantime I have to use routes.php and hard code the slug URLs as follows for each locale:
'contact-us/<teamid>' => ['template' => 'pages/index'],
'cysylltu-â-ni/<teamid>' => ['template' => 'pages/index'],
It would be great if I could either: 1) Use the CMS routes with this wildcard AND routes.php still works for all my others, or 2) Add a wildcard in routes.php (my preference)
Thanks
As for your issue, there's no wildcard in the routes.php becauce any
– Maxime Lafrenière Jan 28 '19 at 14:16<param>can be - if no validation is present - anything. But you'll need to be more specific if you dont want all second level page to matched your rule.More specific like that :
This way, the rule will match ony if the first level is an craft element and if the second level is a 6 digits (replace the
– Maxime Lafrenière Jan 28 '19 at 14:186by your own teamid length).<entrySlug:{slug}>part will act as a wildcard, but it will ensure that the first segment is a real/existing slug in your site - and the<teamid:\d{6}>part (with your own digit length to replace the6) will target what is a valid teamid for your contact system - in the case that all teamid have the same length, – Maxime Lafrenière Jan 29 '19 at 15:58