Fix environment folder route when special chars present
What does this MR do?
This MR fixes matching route / route format to environment folder when using special chars, like a dot or dash, inside an environment name.
Does this MR meet the acceptance criteria?
- 
Changelog entry added, if necessary 
- 
Tests added for this feature/bug 
What are the relevant issue numbers?
Closes #29922 (closed)