Jaxel
Well-known member
Okay, lets say I have a URL: domain.com/prefix/string
What I would like to do is retrieve this string as a parameter and send to actionIndex.
The problem then becomes a missing trailing slash.
The url prefix/string would not go to the actionIndex. It would instead try to find actionString. However, if I instead had prefix/string/ (notice the trailing slash), it will go to actionIndex with the parameter being the string. What would be the best way to ensure that "string" gets resolved as a parameter, and never gets seen as an action route?
I was thinking perfect in the route controller, automatically appending the trailing slash using:
This technically works, and doesn't obfuscate urls such as prefix/string/edit.
However, would this be best practice, or would there be another way?
What I would like to do is retrieve this string as a parameter and send to actionIndex.
The problem then becomes a missing trailing slash.
The url prefix/string would not go to the actionIndex. It would instead try to find actionString. However, if I instead had prefix/string/ (notice the trailing slash), it will go to actionIndex with the parameter being the string. What would be the best way to ensure that "string" gets resolved as a parameter, and never gets seen as an action route?
I was thinking perfect in the route controller, automatically appending the trailing slash using:
Code:
$routePath = rtrim($routePath, '/') . '/';
However, would this be best practice, or would there be another way?